Kew Jie Long

Greenhorn
+ Follow
since Sep 09, 2015
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kew Jie Long

i think the problem is the command i used in Terminal to run the code. I am using mac os X, i can't use cd.. but cd\ only. btw, i don't know which command i should use to run the code, since "java test2" is not working correctly
4 years ago
These are the message i got:

Kews-MacBook-Pro:test2 kewjielong$ cd src/test2
Kews-MacBook-Pro:test2 kewjielong$ ls
Test2.class classTest1.class
Test2.java classTest1.java
Kews-MacBook-Pro:test2 kewjielong$ javac *java
Kews-MacBook-Pro:test2 kewjielong$ cd\\
-bash: cd\: command not found
Kews-MacBook-Pro:test2 kewjielong$ cd\
>
Kews-MacBook-Pro:~ kewjielong$ cd netbeansprojects
Kews-MacBook-Pro:netbeansprojects kewjielong$ cd test2
Kews-MacBook-Pro:test2 kewjielong$ ;s
-bash: syntax error near unexpected token `;'
Kews-MacBook-Pro:test2 kewjielong$ ls
build build.xml manifest.mf nbproject src
Kews-MacBook-Pro:test2 kewjielong$ java test1.Test2
Error: Could not find or load main class test1.Test2
Kews-MacBook-Pro:test2 kewjielong$
4 years ago
The second code i show you is different from the file "virus". The second one is created by using IDE(netbeans), and run fine in IDE but output error message when tried to run it in text editor. i use command + B in sublime to compile the file, it output error message. And type "java test2" to run the test2.java file, because it had been compiled in IDE. but still, it give me an error message.

4 years ago
Firstly, i created a file name Test2.java in netbean.

Here is the code:


And created another class in netbeans. Here is the code:



i can run it without any error. but i get error message which i stated in the last post when i tried to open the Test2.java file in sublime and try to compile and run it.
4 years ago
i think the problem is something to do with the tools i used. i tried this in an IDE, it works. but it just can't be work when i tried to compile it on sublime text and try to run it on terminal. btw, i am using mac OS X.

The error message is :
/Users/kewjielong/NetBeansProjects/test2/src/test2/Test2.java:20: error: cannot find symbol
classTest1 hello = new classTest1();
^
symbol: class classTest1
location: class Test2
/Users/kewjielong/NetBeansProjects/test2/src/test2/Test2.java:20: error: cannot find symbol
classTest1 hello = new classTest1();
^
symbol: class classTest1
location: class Test2
2 errors
[Finished in 1.0s with exit code 1]
[shell_cmd: javac "/Users/kewjielong/NetBeansProjects/test2/src/test2/Test2.java"]
[dir: /Users/kewjielong/NetBeansProjects/test2/src/test2]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

Even though this file is work perfectly fine in IDE, it give error message on a text editor and give error message :
Error: Could not find or load main class test2 in terminal when i tried to compile.

So what is the problem ???!!
4 years ago
i Create a folder name "virus". Inside that folder, there are 2 file which are test1.java and test2.java

Here is the code for test1.java:


Here is the code for test2.java:


There is no problem to compile test2.java, but it give me this error message when i tried to compile test1.java
/Users/kewjielong/Java/virus/test1.java:8: error: cannot find symbol
helloworld();
^
symbol: method helloworld()
location: class test1
1 error
[Finished in 0.9s with exit code 1]
[shell_cmd: javac "/Users/kewjielong/Java/virus/test1.java"]
[dir: /Users/kewjielong/Java/virus]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

Can anyone tell me where i did wrongly ? I follow every instruction on how to use class and method, but still can't figure out where is the problem :,(. Please help me.
4 years ago
i am trying to create a application to search a specific word in the file. In a result, i have to read one word to one word from a file. What should i do? i know that is one method call"readLine" but i don't want read a line but a word. How should i make it happen?


Here is my code:


4 years ago