|
How to create a jar file
I’m new to java. I have created a jar file. When I run it by double clicking it, it displays a error message
Failed to load Main class manifest attribute from E:\Test1.jar
I do not know, how to create a manifest file .
Regards,
Chatura Dilan
|
|
|
|
|
|
Make sure the runtime environment has an information of which class within the JAR file is the application's entry point.
To indicate which class is the application's entry point, you must add a Main-Class header to the JAR file's manifest.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I'm new to java and i'm really struggling with this problem to the point of chucking my computer off the roof and burning it
I have to write a program to normalise some data, by getting the largest value in each column and dividing every other value by this so that the data is in the range [0,1].
example of data:
6, 148, 72, 35, 0, 336, 0627, 50, 2
1, 85, 66, 29, 0, 266, 0351, 31, 1
8, 183, 64, 0, 0, 233, 0672, 32, 2
1, 89, 66, 23, 94, 281, 0167, 21, 1
0, 137, 40, 35, 168, 431, 2288, 33, 2
5, 116, 74, 0, 0, 256, 0201, 30, 1
so say for the first column i would divide everything by 8.
I know i should put each column into an array then perform the calculations and then write it back to the file. i just have no idea how to code this. can anybody help please?
|
|
|
|
|
do you get to use java 5? if so it's easy. (sorry for the late post, since this board is dead I don't check it often) anyways, let me know if you still need help....
Brian Van Beek
Inside this room, all of my dreams become realities, and some of my realities become dreams. -Willy Wonka
Sports, geekdom, and all things else, on my blog![^]
|
|
|
|
|
I know this is a shot in the dark because there are only a few people that check this forum but here goes. I was wondering if anyone knew of a good table class that I could use in place of JTable. I see that Qwest has a good table that is part of there JClass, however I was looking for something that was free of charge. Does anyone know of any tables that I could use that would be free?
Thanks!!
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
Hy
Use a DefaultTableModel. with this Model you can make changes.
Then put the DefaultTableModel int the JTabel Constructor. and finish. Now you can work on the Model like every other array and it will change on the gui.
See you
|
|
|
|
|
OMG, a java forum on Code Project... (first I thought is a usual joke,
a spoofed page or things like that, but I ended checking the hosting
domain and things like that, and now is clear).
Running out quickly...
|
|
|
|
|
haha.... some of us must still use java..... so I actually wish there was a link off of the message board pages. If more people knew about this board, and posted here. I would actaully be able to stay on Code Project all day, instead I now have to give my precious time to other web sites...ahhhh!!!
Brian Van Beek
Here's my boring blog! [^]
|
|
|
|
|
hey, HEY!, yeah you in the curly shirt. You forgot you coffee...
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
Have a LAN that my program runs on. I want it to broadcast out information so that any client
on any computer on the same subnet can receive it. The clients will have no idea what IP the
server is running on. I just want them to listen on a port. How do I go about this in a simple
way? If that's possible. The closes thing I've found is multicast but is that over-kill? Is
there a simpler way to do it than multicast?
Thanks,
Rex
I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len
Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.
|
|
|
|
|
There are several divisions within any network solution. Multicast is a very efficient use of network infrastructure compared to broadcast. When you deal with multiple computers you can unicast to each in small numbers, but then as you said elsewhere you have to know your IPs and configure them appropriately.
Broadcast is the next step[^], which your network admit will kick your behind if you use it on a non-private network.
The design of a broadcast system has the clients listening to a port when the server broadcasts all computers receive the same message network-wide, even those not running your software. It's been ages since I did java broadcast, I do C/C++ right now, but my software still uses unicast/broadcast/multicast in different networks as appropriate.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Okay, that's about what I figured would be involved. Now I want to add the twist. In theory this works (in my head) what do you think? I'd like to bundle the program as one piece of code. If the server broacasts every 1 second then this is how I'd like to make the program run.
StartProgram{<br />
if(serverRunning)<br />
{<br />
assumeClientRole()<br />
}else{<br />
assumeServerRole()<br />
}<br />
<br />
serverRunning<br />
{<br />
ListenForServerWaitThreeSeconds<br />
}<br />
<br />
assumeClientRole<br />
{<br />
BeListenerAndListen <br />
}<br />
<br />
assumeServerRole<br />
{<br />
BeServerAndBroadcast<br />
}<br />
}
I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len
Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.
|
|
|
|
|
About the only problem I can see is two computers starting software at about the same time. This produces a wait of three seconds of about the same time, network delays could make up for less than a second startup time. This may not be a problem as long as not tasks are started by autoscript.
I prefer a change in serverRunning to provide tertiary:
serverRunning
{
RequestServerIdentification
ListenForServer
if (replyfrom server) return true; // server online
RequestToBecomeServer
if (replyfrom server) return true; // deny server role, server online
VerifyServerRole
if (replyfrom server) return true; // deny server role, server online
}
It's somewhat overkill for most projects, however it also allows extension to design. For instance in a very important application you may want redundant networks with redundant servers. So one machine could be server on one network, another machine on the second network, all machines tie to both networks. This design allows you to make decisions based on that by validating server role by network. Even if a server exists on one network the server can ignore the request for server info on the other network thus allowing another machine to become server for that network. Once coded it's pretty easy to put logic in each decision process, and you have a double check in case one computer becomes the server while the other is going through the process. Time tagging time up in the message means that others receiving a time-online message longer than theirs drop out of the running for server, they see multiple machines vying for the server role and simply say a server exists because they see other clients trying to be promoted to server.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Yeah! I like that idea. Giving it a go now. Thanks for the advice that seems like a good way to go.
I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len
Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.
|
|
|
|
|
code-frog wrote:
Yeah! I like that idea. Giving it a go now.
One other case you may consider, or not depending on app. I do redundant systems often, so the concept of computer failure is always on my mind.
Think on this scenerio:
You have a server, all is well.
Server machine dies, and comes back, this design allows it to return to being the server.
But what if the machine does not return. All clients are on the network, no one is the server. Do you declare the oldest client app as server afer x amount of time without a server?
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
This would actually be a requirement for what I'm trying to do. I do need a very redundant system and as each instance of the program will have a full copy of data from the current server any one of them could become the server then there would not be any data loss. The only impact would be expiring old server and promoting new server.
Using a timestamp for each client is a convenient way to establish leadership in the event of a missing server.
I figure I can manage everything in a timer event and then nest some loop processing. I want all the objects to be able to send a broadcast message that they are shutting down. There's no reason for the other systems to have to test for a missing server/client if it's not necessary. If the machine is being rebooted I have time to notify everyone. If the connection is lost then fault tolerance in clients will behave appropriately based on well test assumptions in the code.
//results = value returned from socket. Results is empty or not.
//resume = we have found old server or promoted new server now just keep listening as client or pumping if server.
//Program loads
()
//Timer Event that manages state of object.
{
If(results)
{
// stay as client
}
else
{
//We have missing results
loop->
{
//listen for server
}
}
if (serverFound)
{
//resume
}
else
{
//Promote oldest to new server.
//resume
}
}
I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len
Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.
|
|
|
|
|
Java? sounds like an extinct animal or something - its on WWF
~Alexander Kent
|
|
|
|
|
I think it's on tour with Vanilla Ice or was it... Milli Vanilli? Hmm, don't remember.
I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len
Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.
|
|
|
|
|
I know not many people are on this board, but I am trying to save a JTree to a database and am having a hard time trying to figure this one out. I was thinking of using arbitrary numbers to identify the parent node however I am struggling with this. Has anyone had any experience with this before? If so what were your solutions?
Thanks!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
I see no one really reads this still, but I was hoping a few people may see it. Anyway I am still working on saving a DefaultMutableTreeNode to the database and am having a tough time iterating through the tree. I am trying to write a recursive method to do so. Is this the correct way to do this and if anyone can try and show me an example that would be great! Thanks again!!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
I don´t tried this in real. But if you put a DefaultTableModel behinde the Jtabel. Than you can modify the Model and get a [][] of strings ( I think), this might help.
|
|
|
|
|
I was wondering if anyone knew of some good open-source/free jar files. I am looking for things like graphs, tables etc.
Thanks!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
|
Ok..just wondering if anyone else has run into this problem. At work we are building return url's to send to different apps. For this we use MessageFormat.format. for example
l_url = MessageFormat.format(<br />
l_url,<br />
new Object[] {<br />
"fooProcessing?foo=true",<br />
getUrlInfo(),<br />
getDeployment(),<br />
l_userId,<br />
l_returnJsp});
In this example, l_userId is of the object type Integer. Now, lets say for a moment that my userId is 1011. Now when I call the toString() function I get returned "1011". The MessageFormat.format however is somehow formatting l_userId to be "1,011." Which as you guessed, totally blew up our return urls, as when we go to convert that userId to an Integer, it doesn't like the commas. My question is, why did it do this? Shouldn't this just call a simple toString() implicitly as we are inserting them into a string? Another question I have is, if Integer can format that way (with the comma) why can't it take a number with commas in it when creating a new Integer?
Brian Van Beek
My Blog is Awesome, ok maybe not, but is still fun!!
|
|
|
|
|