Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: "A Java Exception has occurred"

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default "A Java Exception has occurred"

    Hi everyone! I hope you are doing great

    I'm new to both, the forum and JAVA. It's been three or four days since I've started programming in this language (I know C and C++ btw), so I'm a noob/beginner/you name it.

    So far, I've learnt how to make graphic applications among other basic staff. The thing is, I've created a program, A VERY BASIC PROGRAM that does simple math calculations and displays the results in a field text. Fortunately, it works pretty well... Buuuuuuuuuuuut if I build it (using netbeans), and try to run it in another computer, a message pops up saying what the title says... How did I solve this? By installing JDK in every single one.

    There must be a way to make it work without installing the JDK, but I just don't know how :C Please, I beg you, try to explain me how and as detailed as possible.

    Thanks in advance! and sorry if there are too many grammar mistakes, I'm not a native speaker.

    --- Update ---

    This pops up:

    Exception in thread "main" java.lang.NoClassDefFoundError: Calculadora_Porcenta
    es/jar
    Caused by: java.lang.ClassNotFoundException: Calculadora_Porcentajes.jar
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: Calculadora_Porcentajes.jar. Program will exit.

    And this is my manifest:

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.9.2
    Created-By: 1.8.0_11-b12 (Oracle Corporation)
    Class-Path:
    X-COMMENT: Main-Class will be added automatically by build
    Main-Class: calculadora_porcentajes.Calculadora_Porcentajes


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: "A Java Exception has occurred"

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

  3. #3
    Member jdv's Avatar
    Join Date
    Jul 2014
    Location
    This Land
    Posts
    73
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default Re: "A Java Exception has occurred"

    Show us how you are running this code.

  4. #4
    Junior Member
    Join Date
    May 2017
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: "A Java Exception has occurred"

    The best way to avoid exceptions is to program in a manner which you detect them right before they come. Try to think about every possible situation and consider it. There are ways you can detect those exceptions, with programs, such as checkmarx or a lot others you can use as help.
    Good luck with it, Ben.

  5. #5
    Member
    Join Date
    May 2017
    Location
    Eastern Florida
    Posts
    68
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default Re: "A Java Exception has occurred"

    This thread is over 2 years old. I don't think anyone will be waiting for an answer.

Similar Threads

  1. Replies: 6
    Last Post: August 16th, 2014, 01:34 AM
  2. Replies: 1
    Last Post: July 1st, 2013, 03:21 PM
  3. Replies: 2
    Last Post: June 22nd, 2013, 10:30 AM
  4. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  5. Replies: 7
    Last Post: August 13th, 2011, 01:22 AM