basically my program runs like this
1. open up configure GUI
2. get congiguration
3. close configure GUI
4. open up main GUI

now when I am testing in netbeans, this works perfectly however, as soon as I compile and try to run the jar file outside of netbeans the 4th step fails. I am at a loss as to why this is happening so if anyone can shed some light on it it would be a great help

Recommended Answers

All 13 Replies

Without actual error message(s), the code in question, and a listing of the jar contents it's very hard to identify where you have gone wrong!
One likely area is that some classes are missing from the jar, or are not in the correct folders within the jar, but the error message(s) would make that clear.
Give us enough info to work with please.

this code sets up the GUIs:

setupGUI = new SetupGUI (true); // create the setupGUI
setupGUI.waitForDataFromSettupGUI (); // waitUntil the setupGUI is done
handle = setupGUI.getUser(); // get setup info
chatChannel = setupGUI.getChatChannel();
password = setupGUI.getPassword();
gui = new GUI(chatChannel, handle); // create the main GUI

this code sets up the main GUI

public GUI (String chatChannel, String handle) {
    super ("Chatbox - channel: " + chatChannel + " as user: " + handle);
    initComponents(); // initializes all the GUI elements - created by netbeans

the problem i have is that this all runs flawlessly in netbeans.
and when I run it outside of netbeans it does not generate any errors
however, the second GUI still does not appear.

Did you check the jar contents?
If you run a jar by double-clicking it uses javaw,exe which does not display the console, so you can't see any error messages. Try running your jar with java.exe so you can see any error messages

i have been running through command promt using java -jar "jar file path"

I checked the jar contents and all the necicary classes were there as well

A jar file is just a zip file with some standard contents, so you can open it and browse the contents with any zip program you like - winzip, 7zip, stuffit etc etc. You are looking for a manifest file that correctly identifies the class with the main method, and for a structure of folders that exactly matches your packeges, with all the class files (and any other resources you need) in the right palces.

the jar file contains eveything it is supposed to in the right places and the manifest is forrect

Can you post the contents of the command prompt window when you execute the jar file?
On windows: To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.

C:\Users\al>java -jar "C:\Users\al\Documents\NetBeansProjects\LANMessagingProgram\dist\LANMessagingProgram.jar"

this is the command I use to run the program. no further output is generated by the command prompt

Try doing some debugging by adding calls to println to print out messages on the console to show the progress of the program's execution.

If the program works in the IDE and does not work outside of it, what is different? Are there any catch blocks that ignore errors and do not call the printStackTrace() method?

i have done some more testing and it only works in the netbeans ide, it does not work in jGrasp

I would like to think that this line below maybe your issue... However without seeing the full code, its difficult to see. is it possible for you to post the Full code?

    initComponents(); // initializes all the GUI elements - created by netbeans

Without any more information there isn't anything more I can suggest.

What prints out from the printlns I suggested you add? Were there any that did not print something on the console?

the problem has been solved, it turnes out that there was a loop that it was getting stuck in when it was not running in netbeans because the loop was hogging cpu time and not letting other threads continue. added a delay inside loop, works fine now.
thank for all the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.