Java issue question

Joined
Sep 12, 2009
Messages
31
Reaction score
0
Points
6
Okay I've ran this script successfully in DOS but as I just recently started using a mac book pro I am trying to learn terminal better.

I'm not sure what the heck to think of this, any ideas are appreciated...


my terminal command:
matthew-lastname-MacBook-Pro-2:~ Matt$ javac Documents/Professional/2011_Seg_C/java/Countertest.java



result:

Matt$ Documents/Professional/2011_Seg_C/java/ \\The previous is abbreviated in the following:

java/CounterTest.java
java/CounterTest.java: line 2: /Applications: is a directory
java/CounterTest.java: line 3: 2010_BikeMapForWeb.pdf: command not found
java/CounterTest.java: line 4: 2010_BikeMapForWeb.pdf: command not found
java/CounterTest.java: line 5: 2010_BikeMapForWeb.pdf: command not found
java/CounterTest.java: line 6: Desktop/: is a directory
java/CounterTest.java: line 7: public: command not found
java/CounterTest.java: line 8: /Applications: is a directory
java/CounterTest.java: line 9: 2010_BikeMapForWeb.pdf: command not found
java/CounterTest.java: line 10: 2010_BikeMapForWeb.pdf: command not found
java/CounterTest.java: line 11: 2010_BikeMapForWeb.pdf: command not found
java/CounterTest.java: line 12: Desktop/: is a directory
java/CounterTest.java: line 13: syntax error near unexpected token `('
java/CounterTest.java: line 13: ` public static void main(String[] args) {'


I tried to run even some very basic code:

/**
* This is the main method for this class
*
*
* @author XXXXXX
* @param args
*/

public class testcheck {
public static void main(String[] args) {
int one;
String name;
one = 25;
name = "Fred";
System.out.println("The integer is: " + one + "\n"
+ "The name is: " + name);
}
}

with the following:

Matthew-lastname-MacBook-Pro-2:~ Matt$ javac Documents/Professional/java/testcheck.java


Documents/Professional/java/testcheck.java:20: illegal character: \0

^
Documents/Professional/java/testcheck.java:20: illegal character: \0

^
Documents/Professional/java/testcheck.java:20: illegal character: \0

(This error repeats 100x)

--This compiled and ran with no errors in DOS

I know java is integrated, but is there anything at all I need to download that could be causing this? An update or package or anything?
 
OP
M
Joined
Sep 12, 2009
Messages
31
Reaction score
0
Points
6
here is some more info:


machine:~ Matt$ java -cp ./ testcheck.java

Exception in thread "main" java.lang.NoClassDefFoundError: testcheck/java

Caused by: java.lang.ClassNotFoundException: testcheck.java
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)


would it make a difference if the files were written on windows in jEdit and then transferred to OSX? The path still points to them unless its an issue with the text file itself...
 
OP
M
Joined
Sep 12, 2009
Messages
31
Reaction score
0
Points
6
I have figured out the problem. I originally wrote these codes in jEdit (Windows). I transferred the files to OS X and opened them, edited them and even re saved them - overwriting the previous files. It was not until I made completely new files and cut the code, pasted it into a word pad and then into jEdit.

Just a weird oddity I guess... several hours later...
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top