473,320 Members | 2,020 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,320 software developers and data experts.

Classpath

Hi,

I am new to java.

I have developed a single file

class cname
{
import java.io.*;
{
public static void main (Strings args[])
{
// some code
}
}

when i compile above programme, i found follwoing error
import java.io - illegal of start type
^

I think it may be due to improper classpath setting.

any help will be sincerely appreciated.


Hardik Shah
Jul 26 '07 #1
1 860
JosAH
11,448 Expert 8TB
Hi,

I am new to java.

I have developed a single file

class cname
{
import java.io.*;
{
public static void main (Strings args[])
{
// some code
}
}

when i compile above programme, i found follwoing error
import java.io - illegal of start type
^

I think it may be due to improper classpath setting.

any help will be sincerely appreciated.


Hardik Shah
Java's syntax is a bit different; from to top bottom, you have to do this:

1) an (optional) package statement (you dont' need one for now);
2) all the classes you'd need to import;
3) your class or interface definition(s).

So your file should look like this:

Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2.  
  3. class cname {
  4.  
  5.    public static void main (Strings args[]) {
  6.       // some code
  7.    }
  8. }
  9.  
When you want to post some more, have a look at the little pane to the right
of the edit window: it explains how to make your code look like code.

kind regards,

Jos
Jul 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Herman | last post by:
Hi everyone, I recently installed the Sun J2SE SDK on my machine, and I am having trouble running the java.exe interpreter for my Java compiled code. I remember that I had to set my environment...
1
by: Christopher V. Kimball | last post by:
How do I put many jar files into the classpath without having to name each one? This is in Windows 200, in which setting any environmental variable is tedious. Chris Kimball
1
by: Tom | last post by:
How can you figure out exactly where in the classpath a class is located ? For example, assume that my computer has a class "com.MyCompany.MyClass" that is physically located in the jar-file...
2
by: David Cook | last post by:
Windows (XP and NT) allows one to specify environmental variable (such as PATH and CLASSPATH) at both the SYSTEM-wide level as well as at the per-USER level. And the behavior has always been...
4
by: Abdelhalim MIMOUNI | last post by:
hi, i'm new to java, and using sun last JDK, and i'm trying to understand how work this feature when we want to compile at command line ? i'm trying to set the classpath to the directory of the...
1
by: Dave Keays | last post by:
I am setting-up an experimental web service using Apache Axis but I'm having problems. AXIS can't find a library that I've verified exists on my computer and that CLASSPATH points to it. I'm using...
3
by: jeremiah johnson | last post by:
Okay this is going to sound really dumb. Skeet, you can poke fun of me in your own special way if you see fit. Is there a way to reproduce the CLASSPATH functionality of Java within C#? Would...
7
by: dlarsson | last post by:
Okay folks, I thought I was doing something very, very simple, but I cannot seem to get this to work at all. Can anyone identify what I am doing wrong here-? _________________________________ ...
9
by: KevinRobinson | last post by:
Hi, Can anyone please tell me how to add or change a Java classpath in SUSE Linux 9.3. I have set up a Tomcat server but my Java Classes will not run although they do on a windows box. ...
1
Ganon11
by: Ganon11 | last post by:
Hey all, I'm setting up my computer to run Java for a class I'm taking, and I've gotten into a bit of a snag. I've set the CLASSPATH system variable to include the base folder of my homeworks...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.