Page 1 of 2 12 LastLast
Results 1 to 20 of 22
  1. #1
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Question how to correct "Java Exception Occurred" in java desktop application

    Hi
    i try to build an simple desktop application using jdk 1.7 by Netbeans7.01 IDE

    if i run the project it run well in Netbeans and i can create jar by "clean & build" option,
    the jar self also running in side it's own folder.
    But!
    my problem is, if is shift jar in another location it not working & show an exception in dialog box
    like "Java Exception Occurred"
    title as "Java Virtual Machine Launcher "

    Any one can help me how to correct the exception,
    i m waiting for your help friends..,
    Thank you..,
    how to correct "Java Exception Occurred"  in java  desktop application-exception.jpg

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    You need to supply us with some more details on the exception message rather then just "Java Exception Occured".

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    Does the dist folder containg the jar file (the one generated by Netbeans) contain anything else?
    For example, other jars that yours uses.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    sorry for late replay sir, now only the electric power is back.,

    jest i create a new Desktop application and add one label on it, that's all,

    this is the package file in Netbeans


    how to correct "Java Exception Occurred"  in java  desktop application-untitled-1.jpg

    and

    This is the out put

    how to correct "Java Exception Occurred"  in java  desktop application-untitled-2.jpg

    what i have to do now please..,

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    Run the jar file from the command line for starters, just to ensure it works there.
    java - jar <your jar file>
    If there are exceptions you'll at least see them.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    but if i create an application by choosing with netbeans "Newproject > java > javaApplication in swing".
    it is working well, can create jar, i can move & run at any place in my pc,

    the problem is even i unable to netbeans "Newproject > java > javaDesktopApplication"
    it is also working well,
    can create jar,
    i can move .
    But!
    i con't run at any place in my pc sir,

  7. #7
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    sir as you said i try to run the jar file from the command line for starters, just to ensure it works there.
    java - jar <my jar file>

    but it says
    how to correct &quot;Java Exception Occurred&quot;  in java  desktop application-5.jpg

    how to correct &quot;Java Exception Occurred&quot;  in java  desktop application-6.jpg

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    What happens when you do as suggested by Tolls?
    Open a command prompt window, change to the directory (using the cd command) with the jar file and enter:
    java -jar <JARFILENAME>.jar

    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.

    The error message in the image says there is a missing class. Is that class file in the jar file? Use a zip file utility to view the jar file contents.
    Last edited by Norm; 04-04-2012 at 02:38 PM.
    If you don't understand my response, don't ignore it, ask a question.

  9. #9
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    Ok Mr.Norm, sorry for my mistake,
    i will fallow you hereafter..,

  10. #10
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    sir!
    when i extract by using zip
    the MANIFEST.MF file contains
    "
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.8.2
    Created-By: 1.7.0_01-b08 (Oracle Corporation)
    Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
    X-COMMENT: Main-Class will be added automatically by build
    Main-Class: billtest.BillTestApp
    "

  11. #11
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    what i have to do with this sir..,

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    Where is the missing class? You need to put its definition on the classpath.
    If you don't understand my response, don't ignore it, ask a question.

  13. #13
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    can you please guide me sir,
    how to do that?..,

  14. #14
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    Quote Originally Posted by raj.mscking@gmail.com View Post
    sir!
    when i extract by using zip
    the MANIFEST.MF file contains
    "
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.8.2
    Created-By: 1.7.0_01-b08 (Oracle Corporation)
    Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
    X-COMMENT: Main-Class will be added automatically by build
    Main-Class: billtest.BillTestApp
    "
    See my first post.
    Your jar file was created in a directory called 'dist'.
    I asked if there was anything else in that folder, because everything in that folder is needed for your app to run.
    I would bet that there's a 'lib' folder in there, containign those two jar files.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  15. #15
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    Look in all the jar files you have for the missing class file. When you find the jar file with the missing class file, add it to the classpath.

    I don't know how the java program uses the Class-Path: entry in the manifest. I've only used that entry with jars files in the same folder. Your Class-Path: entry has a path. Remove the path and put the jar files in the same folder.
    If you don't understand my response, don't ignore it, ask a question.

  16. #16
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    thank you sir!
    their are two jar files as being in that project folder as you said..,

    jest i try to in netbeans, highlight the project > right click > select project property > library > "it contains the swing application framework zip file in it"

    is their any other way to i add this two jar files sir.,

  17. #17
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    Sorry, I do not know how to use your IDE.
    If you don't understand my response, don't ignore it, ask a question.

  18. #18
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    OK sir!
    i am very happy with your guidance,
    today i can understand the exception reason by you.,
    i will try to search some internet resources..,
    Thank you sir..,
    Have a happy day..,

  19. #19
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    The idea behind the Netbeans dist folder is that that is the folder you distribute for your app to run.
    Hence the name...'dist'.
    Netbeans sticks dependent jars in a lib folder in order to not confuse which jar file is the executable one.
    It's a lot neater.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  20. #20
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    284
    Rep Power
    3

    Default Re: how to correct "Java Exception Occurred" in java desktop application

    Thank you Mr.Tolls, in this forum i learning lot and lot,
    i am very happy to be a member within it with all your's guidance,
    Thank you sir..,

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 5
    Last Post: 12-21-2011, 06:44 PM
  2. Replies: 0
    Last Post: 11-25-2011, 06:16 AM
  3. Replies: 14
    Last Post: 04-08-2011, 06:01 PM
  4. Replies: 3
    Last Post: 03-21-2011, 01:48 PM
  5. Replies: 1
    Last Post: 11-20-2009, 07:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •