How to set classpath to use imported packages?
Hi all,
a real newbie question:
I have created a class in which i import the java.io package. I can compile this class with the Oracle JDeveloper IDE (this is a variation on JBuilder).
The problem is that i can't run this class because (most probably) the java.io package is not in the class path.
Which jar file should i include in my classpath?
jdk1.3\src.jar
or jdk1.3\lib\tools.jar
or jdk1.3\lib\dt.jar
or ...
Where can i find information on this? How can i find structure in the jungle of classes and packages?
thanks, Bart
If you want to execute this class file there are two ways you can do this:
First set your environment PATH:
Second you can explicitly state the classpath: for example
change to the directory with the class file:
cd c:\progra~1\Oracle\JDEVEL~1.0\MYCLAS~1
while in the directory type
java -classpath c:\progra~1\Oracle\JDEVEL~1.0\MYCLAS~1 HelloWorld
Hope this helps.
Similar Messages
-
How to set request number of info package using start routine
Hi All,
I have a specific requirement in which I need to upload only selective request nos from PSA to DSO.
Any one can suggest how to set request number of info package using start routine or any other mode so that only selective request should proceed using DTP?
Thanks
SangitaYou'll probably want to do this in a start routine. It is probably not advisable to hard-code the technical name of the InfoPak. They seem to remain the same upon transport, unlike DTP technical names which are locally generated.
I would do a SQL select like this in a start routine, and then filter based on the results of the SQL. You'll probably want to sort the results by date and time, both descending. Or do a MAX in the SQL.
Please let me know if this isn't clear.
select q~rnr q~logdpid q~tdatum q~tuzeit
from rsreqdone as q
inner join rsldpio as p
on p~logdpid = q~logdpid
where p~objvers = 'A'
and p~logdpid like 'ZPAK%'
and p~source = 'your data source' -
How to set proxy authentication using java properties at run time
Hi All,
How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
=> Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
import java.io.*;
import java.net.*;
public class DnldURLWithoutUsingProxy {
public static void main (String[] args) {
URL u;
InputStream is = null;
DataInputStream dis;
String s;
try {
u = new URL("http://www.yahoo.com.au/index.html");
is = u.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
//Close the input stream
dis.close();
} catch (MalformedURLException mue) {
System.out.println("Ouch - a MalformedURLException happened.");
mue.printStackTrace();
System.exit(1);
} catch (IOException ioe) {
System.out.println("Oops- an IOException happened.");
ioe.printStackTrace();
System.exit(1);
} finally {
try {
is.close();
} catch (IOException ioe) {
}However, it generated the following message when run behind the firewall:
cd C:\Documents and Settings\abc\DnldURL\build\classes
java -cp . DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
I have also tried the command without much luck either:
java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
There is no problem pinging www.yahoo.com from this system.
I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
Java Control Panel - Use browser settings without success.
Thanks,
GeorgeHi All,
How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
=> Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
import java.io.*;
import java.net.*;
public class DnldURLWithoutUsingProxy {
public static void main (String[] args) {
URL u;
InputStream is = null;
DataInputStream dis;
String s;
try {
u = new URL("http://www.yahoo.com.au/index.html");
is = u.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
//Close the input stream
dis.close();
} catch (MalformedURLException mue) {
System.out.println("Ouch - a MalformedURLException happened.");
mue.printStackTrace();
System.exit(1);
} catch (IOException ioe) {
System.out.println("Oops- an IOException happened.");
ioe.printStackTrace();
System.exit(1);
} finally {
try {
is.close();
} catch (IOException ioe) {
}However, it generated the following message when run behind the firewall:
cd C:\Documents and Settings\abc\DnldURL\build\classes
java -cp . DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
I have also tried the command without much luck either:
java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
There is no problem pinging www.yahoo.com from this system.
I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
Java Control Panel - Use browser settings without success.
Thanks,
George -
I know nothing about UNIX. pls kindly give me some instruction on how to set classpath in UNIX, thanks!
best way is to set in your .profile (name differs between different shells, but whatever the OS/Shell is, it should starts with . and has a 'profile' string in the name). Try ls -a to find the file, edit it, insert lines like this:
CLASSPATH=xxxx
export CLASSPATH
Use : to seperate different path/files.
then every time when you log in, the classpath is setted.
if you already logged in, use the above lines in command line, but it only set class path of the current shell/console.
anyway, you should learn Unix before you do anything, or you'll have more trouble. do a search in yahoo or google to find on line tuturials, and SUN's Java tuturial has some basic instructions on how to use Java in Unix. -
How to set Classpath for MySQL
Hi
I want to connect to my mySQL db with a java program , but I don't know how to install the mySQL connector driver. Can anyone help me? or indicate somewhere where I might find the answer?
And how to set Classpath for MySQL.
my program gives an exception ClassNotFound.
Exception :com.mysql.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at Files.main(Files.java:352)
Plz help me
Thanx
Lalitto make your life easy i tried to connect..
what you have to do is.. you mysql database server should be running
next you have to download one of the version of mysql driver.. i downloaded mysql-connector-java-5.0.5
go to my computer right click - >advance tab -> click on environment variable -> put you path e.g. C:\Program Files\Java\jarFiles\mysql-connector-java-5.0.5\mysql-connector-java-5.0.5-bin.jar
into your classpath in a user variable section..
Try this code
import java.sql.*;
public class MySqlConnect{
public static void main(String [] args){
try{
Class.forName("com.mysql.jdbc.Driver");
String url ="jdbc:mysql://localhost:3306/test";
Connection con =DriverManager.getConnection(url,"root", "password");
System.out.println("Connection: " + con);
}catch(ClassNotFoundException cnfe){
cnfe.printStackTrace();
}catch(SQLException se){
se.printStackTrace();
}have fun
Gurnah -
How to set-up and use FAMILY Sharing
Can someone please explain to me in detail how to set-up and use FAMILY Sharing, none of the information I have so far found in the documentation helps at all, in fact it puts you in a constant loop giving the same information over and over again
We have quite a few devices from ipads, iphones and ipods and I need to set-up Family Sharing.
We have our main Apple ID which is linked to our Payment method, I have now got my son a new iPad, I have created his Apple ID and set-up a link via FAMILY Sharing to our main Apple ID.
From what I read we should be able to share our purchased Apps between family members.
So I figured I would be able to get the Apps now via iTunes that are part of the FAMILY Sharing, however when I go into ITunes (latest version downloaded yesterday) I can only see the Home sharing menu item not FAMILY Sharing, so I cannot work out in Itunes how to get Apps that are FAMILY shared. So ok I will try and get Apps directly via the Ipad using the App Store. To test it is working I look for a known paid for App, I then go to download it and it is now asking me to pay for it again.
Can someone please explain to me in detail how FAMILY Sharing is supposed to work and how I get it to work please.
Thanks for your help
GregHey GregWr,
Thanks for the question. The following resources provides some of the best information regarding Family Sharing. Included, you’ll find information on making sure the accounts are set to "Share my purchases”, as well as information on downloading Family Member purchases from the iTunes Purchased section. Please note that some applications are not shareable.
Sharing purchased content with Family Sharing - Apple Support
http://support.apple.com/en-us/HT201085
Which purchased content can I share using Family Sharing - Apple Support
http://support.apple.com/en-us/HT203046
If you don't see your family's shared content - Apple Support
http://support.apple.com/en-us/HT201454
Thanks,
Matt M. -
How to set up shared use of "Contacts" data w/ 2 individual user accounts?
How to set up shared use of application "Contacts" data for two individual user accounts?
Link the contacts in one user account to a online cloud based system like Google or apples iCloud and then link the second user to that same online account. This could cause some slight problems if both people maintain their own online account to either of those systems on a phone or pad.
-
How to set up and use AirPlay
Welcome to the Apple Community.
AirPlay; When watching suitable content on the iPad, tap the screen to bring up the controls, tap the AirPlay icon and select the Apple TV. The content will then stream to the Apple TV.
Mirroring; Double tap the home screen button, swipe the application panel to the right, tap the AirPlay icon and choose the Apple TV. The iPad screen will then be streamed to the Apple TV. -
How to set a job to import automatically transport requests
I wander how to set a job to import automatically transport requests
Hi jan Bo,
http://help.sap.com/saphelp_erp2004/helpdata/EN/44/b4a3c57acc11d1899e0000e829fbbd/frameset.htm
Usung above link you can schedule a transport, if you schedule this job a back ground job will be defined copy this job and create a new varient with your transport request. Make this job run after the back ground job you want.
Regards,
S.Manu. -
How to set unequal columns using master pages in InDesign CS3?
How to set unequal columns using master pages in InDesign CS3?
I don't have CS3 anymore but I don't think this has substantially changed in the last few versions of InDesign.
Choose View > Grids & Guides > uncheck Lock Column Guides. Then drag the column guides to the position you want. -
Hi experts,
Has BPC some limits of records for one flat file (excel) in order to upload data using Import Package? If the answer is yes, could anybody tell me more info about it?
I tried run the package Import with one file .xls, it has around 60 000 records, and i received one error of Overflow.
Thanks,
Best Regards,
JuanThis may not be relate dto the IMPORT process, but rather the running of Defualt logic during the process. I would try to load the data with the Defualt logic disabled. (you can always run it later) My guess ist thatthe scope of the logic exceeds the memory capacity of the server during the load, but after the data has been in-process of loading.
Try that and let us know. -
How to Set CLASSPATH in Apache Web Server Using IAS
Hi,
I have problem setting the classpath for the servlet I am using for file uploading...My work environment is Web Server is Apache with Oracle8i IAS on Sun Solaris..
I have tried various method like setting wrapper.classpath=/oracle/ias/Apache/Jserv/servlets and my class resides under /oracle/ias/Apache/Jserv/servlets/com/oreilly/servlets/MultipartRequest.class
in the Jserv.properties, still it get the error message class ...not found in type declaration when I compile the code...my reference to the servlet in my JSP code is com.oreilly.servlet.MultipartRequest ..
Can someone help me out please, if you have have any idea of how to set the class path with the working environment I have specified ealier....
nullhave you posted this on the ias 9i forum where the ias 9i apache experts are at ??
-
How do I create and use a package?
Sorry for the noobish question, but I have never had the need to use a package and currently would like to learn how they work just to satisfy my own curiosity.
Suppose I have a file named Node.class in a folder named Classes, and I have another class named Main.class sitting in another folder. I want to create a Node object using the Main class.
How do I accomplish that? Would I need to use a package?
I tried to write package Classes; on my Main file but it did not work. thanksThis is an old explanation I wrote:
This is a minimal explanation of packages.
Assume that your programs are part of a package named myapp, which is specified by this first line in each source file:
package myapp;
Also assume that directory (C:\java\work\) is listed in the CLASSPATH list of directories.
Also assume that all your source files reside in this directory structure: C:\java\work\myapp\
Then a statement to compile your source file named aProgram.java is:
C:\java\work\>javac myapp\aProgram.java
And a statement to run the program is:
java myapp.aProgram
(This can be issued from any directory, as Java will search for the program, starting the search from the classpath directories.)
Explanation:
Compiling
A class is in a package if there is a package statement at the top of the class.
The source file needs to be in a subdirectory structure. The subdirectory structure must match the package statement. The top subdirectory must be in the classpath directory.
So, you generate a directory structure C:\java\work\myapp\ which is the [classpath directory + the package subdirectory structure], and place aProgram.java in it.
Then from the classpath directory (C:\java\work\) use the command: javac myapp\aProgram.java
Running
Compiling creates a file, aProgram.class in the myapp directory.
(The following is where people tend to get lost.)
The correct name now, as far as java is concerned, is the combination of package name and class name: myapp.aProgram (note I omit the .class) If you don't use this name, java will complain that it can't find the class.
To run a class that's NOT part of a package, you use the command: java SomeFile (assuming that SomeFile.class is in a directory that's listed in the classpath)
To run a class that IS part of a package, you use the command java myapp.aProgram (Note that this is analogous to the command for a class not in a package, you just use the fully qualified name) -
How to set classpath from java class ??
I have tried to use System.setProperty("java.class.path", "my class path string ") to set classpath dynamically. But it is not working. How to set it dynamically from java class ?? Thanks , gary
Look into the java.net.URLClassLoader. You can't set the classpath after the fact but you can specify URL's that will checked when you try to load a class with that loader.
-
Find jar file using imported packages
Hi,
Shall i know how to find jar name..I'm having imported files..
For an eg,
i'm having the below one..
import org.bouncycastle.tools.openpgp.util.PGPParams;
import org.bouncycastle.tools.openpgp.util.ProcessingEngine;How to find jar by using the above imported packages?sabre150 wrote:
You can't.
Do you mean you want to download the BouncyCastle openpgp jars? If so then visit www.bouncycastle.org .
Edited by: sabre150 on Sep 7, 2009 11:46 AM
I give up on the OP. He has been doing this pgp now for more than 10 weeks and he seems unable to do more than ask daft questions or repeatedly ask for code.Maybe he's Italian. I mean, Deepa is in Deepa Shita. ;-)
Maybe you are looking for
-
Issues With Deleting Printer Drivers
I'm currently using an Epson Stylus Photo 1400, and when I went to Epson.com to try and download the software that checks the ink levels, does diagnostics, etc, I accidently downloaded their EasyPrint which basically strips down the settings availabl
-
hi guys i have configured trusted identity provider for my public facing internet portal, but i dont want to use the login screen since i have about 10 site collection which will use this authentication. is there a class or property that gives me the
-
How do i transfer photos on an ipad to my photo stream?
I have over a 1,000 pictures that are on my IPAD in Photos. I'd like to move them to my Photo Stream on my IPAD so that I can have them on my Mac Pro and IPhone. Appreciate any suggestions.
-
When I close my laptop and open it up later it doesnt come on like it used to.
The power light is on but the screen wont come up. I have to hold the power button to restart it.
-
How To Modify Navigation Panel + Menu?
I have Reader Professional. 1)I would like to remove some buttons from the navigation panel docked on the left. Particularly the signatures button. 2) I would like to remove some of the buttons and labels from the toolbars on the top and REMEMBER tha