473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

beginners Compile error cannot resolve symbol

Hello!

I get compile error when compiling using the command javac from the command
terminal window(CMD).
I have just two classes which are called HelloWorld.java and Slask.java.
I have both classes in the directory called temp and I do cd temp to this
directory.
Then I do javac HelloWorld.java
Now I get the compile error
HelloWorld.java:8 cannot resolve symbol
symbol : class Slask
location: class helloWorld
Slask slask = new Slask(); //And the top sign is pointing at the first
Slask

HelloWorld.java:8 cannot resolve symbol
symbol : class Slask
location: class HelloWorld
Slask slask = new Slask(); //And the top sign is pointing at the last
Slask

If I use for example the Blue J IDE than it works or if I put these two
files in a project and compile with
Microsoft visualStudio J# it also works. But why do I get compile error when
using the javac from the terminal window(cmd)

import java.io.*;
public class HelloWorld
{
private String out;
public HelloWorld()
{
Slask slask = new Slask();
out = "Hello world";
}

public void printHelloWorld()
{
System.out.println("skriver ut:" + out);
}

public static void main(String args[])
{
HelloWorld hw = new HelloWorld();
hw.printHelloWorld();
}
}

import java.io.*;
public class Slask
{
private String out;
public Slask()
{
out = "slask";
}

public void printslask()
{
System.out.println("skriver ut:" + out);
}
}

//Tony
Sep 11 '05 #1
1 24779
UniDyne
18
Try:

Expand|Select|Wrap|Line Numbers
  1. javac -cp . *.java
This should compile. The trick is to tell Java what the classpath is. "-cp ." tells Java that the classpath is the current directory. If you wanted to include other directories, you would list them as well, separated by semicolons:

Expand|Select|Wrap|Line Numbers
  1. javac -cp .;c:\my\dir\here\;c:\some\other\path;c:\path\to\jarFile.jar *.java
Oct 5 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: yanwan | last post by:
I met this problem in executing a c++ project in visual studio. Does anyone have suggestions to resolve "error lnk 2001"? --------------------Configuration: reconstruction - Win32...
0
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
2
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
0
by: JW | last post by:
I'm using MSVC7.0 and I'm getting a ton of errors with most of them occurring in cstdio. Any thoughts as to what might cause this? d:\Program Files\Microsoft Visual Studio .NET\Vc7...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
3
by: Sindhu Rani | last post by:
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do??? C:\s\source>javac -d ..\classes devtestdrive.java devtestdrive.java:5: cannot resolve symbol...
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.