Results 1 to 3 of 3
  1. #1
    Vinx is offline Member
    Join Date
    May 2012
    Location
    USA
    Posts
    38
    Rep Power
    0

    Default Simple Syntax Error(s)

    Would anyone mind taking a look at this?


    Making a simple console application to calculate the number of shells in my string.

    There's probably a few syntax issues, but I'm getting this error:

    Java Code:
    Starting...
    Application Started...
    Deleting old files...
    Checking Libraries...
    Copying files...
    Processing Files...
    Compiling...
    Build Success
    ------------------------------
     
    Exception in thread "main" java.lang.NoClassDefFoundError: Project
    Caused by: java.lang.ClassNotFoundException: Project
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    Could not find the main class: Project. Program will exit.
    Here's the source code, also I'm using Online Compiler & IDE for C, Java, C# and C++ | Compilr as an IDE.

    Program.java
    Java Code:
    import java.lang.*;
    public class Program {
    	public static void main (String[] args) {
    	String[] getShells = {"http://127.0.0.1/shell.php","http://127.0.0.1/shell.php","http://127.0.0.1/shell.php"};
    	String shellWord = "shells";
    	int shellCount = (int) getShells.length;
    	if (shellCount == 1) {
    		shellWord = "shell";
    	}
    	System.out.println("There are" + shellCount + shellWord);
    	}
    }

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: Simple Syntax Error(s)

    java.lang.NoClassDefFoundError: Project
    where is the class named: Project? The java program can not find it.
    The code you posted is for the class named: Program
    The error is from the java program at runtime, not a compiler error which is where you would see syntax errors.

    If you are using an IDE, you need to ask someone that uses one like yours how to configure it. There is a section of this forum for IDEs.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Vinx is offline Member
    Join Date
    May 2012
    Location
    USA
    Posts
    38
    Rep Power
    0

    Default Re: Simple Syntax Error(s)

    Quote Originally Posted by Norm View Post
    where is the class named: Project? The java program can not find it.
    The code you posted is for the class named: Program
    The error is from the java program at runtime, not a compiler error which is where you would see syntax errors.

    If you are using an IDE, you need to ask someone that uses one like yours how to configure it. There is a section of this forum for IDEs.
    Thank you for the help! This lead me to trying Eclipse, in which I was able to repair the code easier and it isn't restricted like the online IDE I was trying.

    Here's the fixed code, incase if it's use for anyone else:

    Program.java(Class)
    Java Code:
    /**
     * 
     */
    
    /**
     * @author Computer Owner
     *
     */
    public class Program {
    
    	/**
    	 * @param args
    	 */
    	public static void main(String[] args) {
    	    String[] getShells = {"http://127.0.0.1/shell.php", "http://127.0.0.1/shell.php", "http://127.0.0.1/shell.php"};
    	    String shellWord = "shells";
    	    String areIs = "are";
    	    int shellCount = (int) getShells.length;
    	    if (shellCount == 1) {
    	        shellWord = "shell";
    	        areIs = "is";
    	    }
    	    System.out.println("There " + areIs + " " + shellCount + " " + shellWord);
    	    
    	
    
    	}
    
    }

Similar Threads

  1. javadb syntax error
    By ron2794 in forum JDBC
    Replies: 9
    Last Post: 01-06-2011, 03:21 PM
  2. No more syntax error
    By ideyatech in forum Java Software
    Replies: 2
    Last Post: 04-22-2010, 04:20 AM
  3. stuck on same syntax error....
    By Moltisanti in forum New To Java
    Replies: 2
    Last Post: 09-01-2009, 04:26 AM
  4. simple loop syntax( ; ;), ( something : somthing)
    By xcallmejudasx in forum New To Java
    Replies: 4
    Last Post: 12-13-2008, 12:19 PM
  5. syntax error
    By gabriel in forum New To Java
    Replies: 3
    Last Post: 08-03-2007, 03:26 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
  •