Java/Programming Help

maniac

New member
So to keep this short, I've been studying programming for the past 5 years at school, did 3 years with pascal, 2 with java and until now 4 months learning C.

Now I was doing some java coding for a program I actually need and will use but I wish to create a .jar file using BlueJ so I can execute the program without having to open BlueJ everytime. My program has 3 classes, one is the header, the implementation and the main class, can anyone shed any light on how to successfully create a jar file? I did look up on the interwebs but still didn't manage to create one.

regards,
maniac
 
Ok i've been out of the Java programming game for a while (about as long as you've been studying programming)... but isn't C/C++ the ones which have seperated headers and class files?

All my memories of java are main class, which calls the first implementation class which then starts doing stuff....

In any event, I have no idea about BlueJ - I always used either eclipse or netbeans - both of which have an option which auto compiles .jar files when you do a publish. I would expect something similar within BlueJ to be honest.
 
Ok i've been out of the Java programming game for a while (about as long as you've been studying programming)... but isn't C/C++ the ones which have seperated headers and class files?

All my memories of java are main class, which calls the first implementation class which then starts doing stuff....

In any event, I have no idea about BlueJ - I always used either eclipse or netbeans - both of which have an option which auto compiles .jar files when you do a publish. I would expect something similar within BlueJ to be honest.

true its not called a header file, but I'm not sure what to call it, its the one that has getters and setters and stuff like that.

Yes there is an option to create a header file but when you open the file nothing happens (apart from creating the text file to save stuff). All I found on the internet involved using cmd to include the .java files, that is the part that lost me.
 
true its not called a header file, but I'm not sure what to call it, its the one that has getters and setters and stuff like that.

Yes there is an option to create a header file but when you open the file nothing happens (apart from creating the text file to save stuff). All I found on the internet involved using cmd to include the .java files, that is the part that lost me.

Any class can have getters and setters. That is the proper way to do things in Java, if you want to ensure that your global variables (or instance variables if you prefer) are protected properly.

I'm guessing that the part you are getting lost at, while trying to compile the .jar files is the -Djava switch? If this is the case what you need to do is to point the -Djava to every single class which is a requirement of your program: both the ones you made, and any which might exist in other libraries. In essence, what you are doing is setting up your dependencies. If they are not set up properly, you won't get a .jar...
 
What IDE do you use? If you're using Eclipse in windows, I can tell you how it works, gimme a second, will edit this post when I have the way.

Eclipse:

File -> Export -> Runnable Jar File -> (Select the project you want to have as .jar) -> Hit finish

Thats how you do it with Eclipse, which is btw. the easiest Java IDE I have come across so far.


Un an unrelated note: stop the sickness that is java. Use C++. :p

Edit2:

http://www.bluej.org/help/archive.html#tip7

This might also help... ;)
 
Last edited:
What IDE do you use? If you're using Eclipse in windows, I can tell you how it works, gimme a second, will edit this post when I have the way.

Eclipse:

File -> Export -> Runnable Jar File -> (Select the project you want to have as .jar) -> Hit finish

Thats how you do it with Eclipse, which is btw. the easiest Java IDE I have come across so far.


Un an unrelated note: stop the sickness that is java. Use C++. :p

Edit2:

http://www.bluej.org/help/archive.html#tip7

This might also help... ;)

I already tried the bluej, the jar file is created but nothing happens when I launch. so I guessed I was missing something.

I don't know C++, I think I will learn that next semester or next year. I will probably download eclipse for java and try on that as currently I have eclipse for C/C++.
 
Back
Top