?
Solved

a question about jdk1.4~~~help~~~

Posted on 2002-04-21
7
Medium Priority
?
258 Views
Last Modified: 2010-03-30
i have a servlet and a CheckUser class. the CheckUser class and the servlet in different path.
so if the servlet want to use CheckUser class must import it..if commented out "import CheckUser;",
the compiler will say "can't find class CheckUser".

but in the CheckUser class, we did not use something like "package com.***.***"....we just put CheckUser
class in a path which is exist in the CLASSPATH...

in jdk 1.3 no problem. but the problem appears in jdk1.4..a error report: says '.' expected

as CEHJ said: Java classes are *always* in packages, even if there is no 'package' declaration...
so, i want to know which package CheckUser belongs to? because i didnot use 'package' declaration.....(if
CheckUser.java in path /home/com/***/ and /home/com/*** in the CLASSPATH)
0
Comment
Question by:wh111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 6957504
post the full javac error message
0
 
LVL 35

Expert Comment

by:girionis
ID: 6957583
 And post your servlet code as well...
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 800 total points
ID: 6957645
The way to avoid the compiler error is to compile thus:
javac -sourcepath <path to CheckUser> <filename>.java
There is no need then to import CheckUser at all.

What I would say though, is that one ought to minimise source file dispersal. Think about the comment you made about packages. If there are the correct relations between packages, there is no need to yank together dispersed source.
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 5

Expert Comment

by:nebeker
ID: 6959738
Java 1.4 is a lot more strict about import statements...
0
 
LVL 9

Expert Comment

by:Ovi
ID: 6962168
Normally if you are sure that your file is in the classparh, never will be necesary to import'it.
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7973096
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: CEHJ
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8021383
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question