Help: Still got problems with package
I still got problems with my self-defined packages. My source files are all put in a directory as the package
name suggests. The questions are:
1. Before the classes in the package can be cited by the outside programmes, should I compile
every sources files in the package respectively?
2. Secondly, I want to put the .class files in another directory, such as \classes\package name, should
I set the path mannully? If yes, how to do it?
3. I downloaded some *.java files from Internet and put them in a directory as their package name suggested.
However, when I run javac a.java I got error: cannot read a.java. What problem could it be?
Thanks!
1. Before the classes in the package can be cited by the outside programmes, should I compile
every sources files in the package respectively?Yes, you can't run .java files. The JVM only uses the .class files, so you have to compile them.
2. Secondly, I want to put the .class files in another directory, such as \classes\package name, should
I set the path mannully? If yes, how to do it?You have to put the .class file in the package directory structure. You have no choice about that.
3. I downloaded some *.java files from Internet and put them in a directory as their package name
suggested. You need to read a lot of stuff, but start with this:
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
However, when I run javac a.java I got error: cannot read a.java. What problem could it
be?You don't run .java files. You run .class files.
Similar Messages
-
8.3 and STILL got problems with Safari
Anyone else still having issues with Safari in 8.3 along the lines of it being unresponsive and generally broken?
I've tried the 'clear history and website data' fix but that hasn't worked. Really annoying!Yes Im having this problem as well, no response, search does not work.
Very frustrating -
Still got problems with java class business operations
Hi all,
I've read the latest on business operations and java class files, but my problem
remains - the workaround of putting the class file in the studio classpath did
not work for me.
To breifly recap the problem -
I am unable to assign an instance variable when trying to call a predefined business
operation of a java class. Calling the constructor seems to work okay and I can
assign the result to a variable of type "java object" but that's as far as it
goes. If I try placing the class file in the studio classpath, my "Instance Variable"
dropdown list dims, but I am still prompted to choose one when I press okay.
I'm using process integrator 2 sp2 on wls6.
Please help!
Regards
AndrewStill no good. I'm running my testing on my own PC with windows 2000. Maybe a
windows bug rather than a remote bug?!
Anyone else have a suggestion?
"Soteri Panagou" <[email protected]> wrote:
>
Andrew
What platform are you running on?
I have found the same problem when trying to run wlpi remotely.
We have a sun box with the WLI installation. When i run wlpi on that
box, and
do the business operation configuration as u describe below, i get instance
variables
populated in the drop down box of the business operation window. I can
then select
the java object my instance is assigned to.
However, when i connect remotely using the studio and try to view the
business
operation settings, nothing appears in the instance drop down box.
When i go back to the console and run the studio on the same machine
as the installation,
the instance variable drop down is populated once again.
So all i can say is, configure the workflow on the machine have the running
installation,
and then it should work. It did for me :)
Hope this helps
Steri
"Andrew" <[email protected]> wrote:
Hi all,
I've read the latest on business operations and java class files, but
my problem
remains - the workaround of putting the class file in the studio classpath
did
not work for me.
To breifly recap the problem -
I am unable to assign an instance variable when trying to call a predefined
business
operation of a java class. Calling the constructor seems to work okay
and I can
assign the result to a variable of type "java object" but that's asfar
as it
goes. If I try placing the class file in the studio classpath, my "Instance
Variable"
dropdown list dims, but I am still prompted to choose one when I press
okay.
I'm using process integrator 2 sp2 on wls6.
Please help!
Regards
Andrew -
Help to solve problem with packaging log4j in a EAR file
Hi All
i struggle hard to create a EAR composed of EJB JARs and WARs and the programs
in these JARs and WARs use log4j to log msg. Because i want all J2EE apps to have
their own version of log4j library, i package log4j.jar in the EAR file. Below
is my EAR package structure
EJB1.jar
EJB2.jar
SharedUtilities.jar
log4j.jar
log4j.properties
WEBAPP1.war
WEBAPP2.war
META-INF/manifest.mf
For both EJB1.jar and EJB2.jar's META-INF/manifest.mf, there is a below entries
Manifest-Version: 1.0
Class-Path: SharedUtilities.jar log4j.jar
However, my program always hit below runtime error.
[java] Caused by: javax.ejb.TransactionRolledbackLocalException: EJB Exception:
: java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
But the program in EJB1.jar and EJB2.jar seem to have no such problem in loading
classes in SharedUtilities.jar. The problem can be eliminated if i put log4j.jar
at system classpath. Can anybody provide me with info on how to package a log4j
library within a EAR package ?
In addition, where should i put the log4j.properties so that it will be at search
path of log4j and automatically loaded by log4j lib
regards
DannyHi Slava Imeshev
I am a bit confused about your reply. As said, the log4j.jar was packaged in my
ear file. If the log4j.jar was not packaged in ear file, how come the ejb classloader
can locate it.
Secondly, if log4j.jar is included in system classpath, the ejb also can load
log4j classes by system classloader. No "NoClassDeffound" exception is thrown.
regards
dso
"Slava Imeshev" <[email protected]> wrote:
"dso" <[email protected]> wrote in message
news:[email protected]...
Hi Slava Imeshev
thanks for your response. I am a bit confused about your answer.
i can't understand why u said the classloader COULD loadorg/apache/log4j/PropertyConfigurator.
According to the error msg, it said
" java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator".
Seemingly,
this class in log4j.jar could not be located. But as i said in lastquestion,
i seemed to have properly
edit the "META-INF/manifest.mf" in EJB1.jar and EJB2.jar to includelog4j.jar
in "Class-path" attribute. And my EJB classes have no problem in loadingclasses
in SharedUtilities.jar. Would u please elaborate on it in more details?
Sure. NoClassDefFoundError means that a DEPENDING class
can not be loaded. If the classloader were not able to load the class
itself, it would give you ClassNotFoundException.
Just make sure that you don't have the same packages in
the ear and in the class path so that you don't have classes
loaded by system classloader trying to load classes loaded
by ejb classloaders.
regards
dso
"Slava Imeshev" <[email protected]> wrote:
First, this error means that classloader was able to load
org/apache/log4j/PropertyConfigurator, but cold not load
one of depending classes. I'd inspect the CLASSPATH
to see if there are any log4 classes there.
Second, you can package your log4.properties into
log4.jar itself.
Regards,
Slava Imeshev
"dso" <[email protected]> wrote in message
news:[email protected]...
Hi All
i struggle hard to create a EAR composed of EJB JARs and WARs and
the
programs
in these JARs and WARs use log4j to log msg. Because i want all
J2EE
apps
to have
their own version of log4j library, i package log4j.jar in the EARfile.
Below
is my EAR package structure
EJB1.jar
EJB2.jar
SharedUtilities.jar
log4j.jar
log4j.properties
WEBAPP1.war
WEBAPP2.war
META-INF/manifest.mf
For both EJB1.jar and EJB2.jar's META-INF/manifest.mf, there is
a below
entries
Manifest-Version: 1.0
Class-Path: SharedUtilities.jar log4j.jar
However, my program always hit below runtime error.
[java] Caused by: javax.ejb.TransactionRolledbackLocalException:EJB
Exception:
: java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
But the program in EJB1.jar and EJB2.jar seem to have no such problemin
loading
classes in SharedUtilities.jar. The problem can be eliminated if
i
put
log4j.jar
at system classpath. Can anybody provide me with info on how to
package
a
log4j
library within a EAR package ?
In addition, where should i put the log4j.properties so that it
will
be at
search
path of log4j and automatically loaded by log4j lib
regards
Danny -
Still major problem with packages
Here is my record
Saved in C:/database/record/record.java
package database.record;
public class Record
{ //Data mebers
public int idNumber; // Key field identifying each product
public int serial; // Serial number situated on product
public int quantity; // Quantity of each product
public String product; // The product's name
public String supplier; // Name of the supplier
public Record()
// Initialising data members
this.idNumber = 0;
this.serial = 0;
this.quantity = 0;
this.product = null;
this.supplier = null;
// Constructor for objects of class BeachRecord
public Record(int Id, int SerialNumber, int Quantity, String ProductName, String SupplierName)
setID(Id);
setSerial(SerialNumber);
setQTY(Quantity);
setName(ProductName);
setSupplier(SupplierName);
// Set Id Number
public void setID(int id)
idNumber = id;
} // End Method
// Get Id Number
public int getID()
return idNumber;
} //End Method
// Set Serial Number
public void setSerial(int serialNumber)
serial = serialNumber;
} // End Method
// Get Id Number
public int getSerial()
return serial;
} //End Method
// Set Quantity
public void setQTY(int Quantity)
quantity = Quantity;
} // End Method
// Get Id Number
public int getQTY()
return quantity;
} //End Method
// Set Product Name
public void setName(String productName)
product = productName;
} // End Method
// Get Id Number
public String getName()
return product;
} //End Method
// Set Supplier Name
public void setSupplier(String supplierName)
supplier = supplierName;
} // End Method
// Get Id Number
public String getSupplier()
return product;
} //End Method
}// End Class BeachRecordThis class creates my text-file
Saved also in C:/database/record/
import java.io.FileNotFoundException;
import database.record.Record;
import java.lang.SecurityException;
import java.util.Formatter;
import java.util.FormatterClosedException;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class CreateTextFileNew
private Formatter output; // object used to output text to file
// enable user to open file
public void openFile()
try
output = new Formatter( "clients.txt" );
} // end try
catch ( SecurityException securityException )
System.err.println(
"You do not have write access to this file." );
System.exit( 1 );
} // end catch
catch ( FileNotFoundException filesNotFoundException )
System.err.println( "Error creating file." );
System.exit( 1 );
} // end catch
} // end method openFile
// add records to file
public void addRecords()
// object to be written to file
Record record = new Record();
Scanner input = new Scanner( System.in );
System.out.printf( "%s\n%s\n%s\n%s\n\n",
"To terminate input, type the end-of-file indicator ",
"when you are prompted to enter input.",
"On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
"On Windows type <ctrl> z then press Enter" );
System.out.printf( "%s\n%s",
"Enter account number (> 0), first name, last name and balance.",
while ( input.hasNext() ) // loop until end-of-file indicator
try // output values to file
// retrieve data to be output
record.setID(input.nextInt());
record.setSerial(input.nextInt());
record.setQTY(input.nextInt());
record.setName(input.next()) ;
record.setSupplier(input.next());
if ( record.getID() > 0 )
// write new record
output.format( "%d %s %s %.2f\n", record.getID(),
record.getSerial(), record.getQTY(), record.getSupplier(),
record.getName() );
} // end if
else
System.out.println(
"Account number must be greater than 0." );
} // end else
} // end try
catch ( FormatterClosedException formatterClosedException )
System.err.println( "Error writing to file." );
return;
} // end catch
catch ( NoSuchElementException elementException )
System.err.println( "Invalid input. Please try again." );
input.nextLine(); // discard input so user can try again
} // end catch
System.out.printf( "%s %s\n%s", "Enter account number (>0),",
"first name, last name and balance.", "? " );
} // end while
} // end method addRecords
// close file
public void closeFile()
if ( output != null )
output.close();
} // end method closeFile
} // end class CreateTextFileProblem is there:
public class CreateTextFileTest
public static void main( String args[] )
CreateTextFile application = new CreateTextFile();
application.openFile();
application.addRecords();
application.closeFile();
} // end main
} // end class CreateTextFileTestI get these errors:
C:\database\record\CreateTextFileTest.java:8: cannot find symbol
symbol : class CreateTextFile
location: class CreateTextFileTest
CreateTextFile application = new CreateTextFile();
^
C:\database\record\CreateTextFileTest.java:8: cannot find symbol
symbol : class CreateTextFile
location: class CreateTextFileTest
CreateTextFile application = new CreateTextFile();
I use TextPad, and i changed the parameters to
-classpath C:\ $File
Can somebody help me fix this pleaseok i think that is fixed but i still get this:
here are the 2 last classes again
import java.io.FileNotFoundException;
import java.lang.SecurityException;
import java.util.Formatter;
import java.util.FormatterClosedException;
import java.util.NoSuchElementException;
import java.util.Scanner;
import com.deitel.jhtp6.ch14.AccountRecord;
public class CreateTextFile
private Formatter output; // object used to output text to file
// enable user to open file
public void openFile()
try
output = new Formatter( "clients.txt" );
} // end try
catch ( SecurityException securityException )
System.err.println(
"You do not have write access to this file." );
System.exit( 1 );
} // end catch
catch ( FileNotFoundException filesNotFoundException )
System.err.println( "Error creating file." );
System.exit( 1 );
} // end catch
} // end method openFile
// add records to file
public void addRecords()
// object to be written to file
AccountRecord record = new AccountRecord();
Scanner input = new Scanner( System.in );
System.out.printf( "%s\n%s\n%s\n%s\n\n",
"To terminate input, type the end-of-file indicator ",
"when you are prompted to enter input.",
"On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
"On Windows type <ctrl> z then press Enter" );
System.out.printf( "%s\n%s",
"Enter account number (> 0), first name, last name and balance.",
while ( input.hasNext() ) // loop until end-of-file indicator
try // output values to file
// retrieve data to be output
record.setAccount( input.nextInt() ); // read account number
record.setFirstName( input.next() ); // read first name
record.setLastName( input.next() ); // read last name
record.setBalance( input.nextDouble() ); // read balance
if ( record.getAccount() > 0 )
// write new record
output.format( "%d %s %s %.2f\n", record.getAccount(),
record.getFirstName(), record.getLastName(),
record.getBalance() );
} // end if
else
System.out.println(
"Account number must be greater than 0." );
} // end else
} // end try
catch ( FormatterClosedException formatterClosedException )
System.err.println( "Error writing to file." );
return;
} // end catch
catch ( NoSuchElementException elementException )
System.err.println( "Invalid input. Please try again." );
input.nextLine(); // discard input so user can try again
} // end catch
System.out.printf( "%s %s\n%s", "Enter account number (>0),",
"first name, last name and balance.", "? " );
} // end while
} // end method addRecords
// close file
public void closeFile()
if ( output != null )
output.close();
} // end method closeFile
} // end class CreateTextFile public class CreateTextFileTest
public static void main( String args[] )
CreateTextFile application = new CreateTextFile();
application.openFile();
application.addRecords();
application.closeFile();
} // end main
} // end class CreateTextFileTestThe CreateTextFileTest compiles now. i get an error in the CreateTextFile class:
:\com\deitel\jhtp6\ch14\CreateTextFile.java:10: package com.deitel.jhtp6.ch14 does not exist
import com.deitel.jhtp6.ch14.AccountRecord;
^
C:\com\deitel\jhtp6\ch14\CreateTextFile.java:40: cannot access AccountRecord
bad class file: .\AccountRecord.class
class file contains wrong class: com.deitel.jhtp6.ch14.AccountRecord
Please remove or make sure it appears in the correct subdirectory of the classpath.
AccountRecord record = new AccountRecord(); -
I had already update mi new factory unlocked iPhone 4S to iOS 5.1.1 and I still having problems with "invalid sim". I'm from Argentina and here we don't have official service. PLEASE HELP ME, WHAT CAN I DO??? In Argentina is too expensive an iPhone 4S. Please I need help to continue believing in Apple. Thanks a lot. If anybody speak spanish better.
Was it purchased from an official Apple Store, not a reseller? Only Apple Stores sell official factory unlocked phones. The others sell hacked to unlock phones, and the unlocking is unstable.
Try these steps, as needed:
1. Reset phone - press both home and on/off buttons for at least 10 seconds until the Apple logo appears.
2. Settings > General > Reset > Reset Network Settings.
3. Replace SIM card (and reset network settings again)
4. Restore Phone in iTunes using a backup
5. Restore in iTunes as new, without using a backup -
After I've upgraded my iPhone iOS to 5.0.1, I got problems with connectivity. If my iPhone lose network, then it gets frozzen and I cannot make calls. After restart the telephone still does not work.
1. Download the iOS 5.0.1: http://www.tobias-hartmann.net/2011/11/download-ios-5-0-1-veroffentlicht-direkte -downloadlinks/
2. open itunes,Click in iTunes while holding down the Shift key (on Windows) or Alt key (Mac) to restore and firmware -
I am still having problems with my music videos freezing (all purchased on iTunes) since the update. The first day of the update, no problems...played 6 hours of music videos and no freezing. Today...every single video froze!!! So frustrating! I rebooted, restarted, powered down and no help. I would appreciate any suggestions. Thanks.
I don't know how to do this without using a mouse point.
This may help, http://www.computerhope.com/issues/ch000542.htm
As for question #2, you call tell how iTunes is sorting songs by the up or down arrow next to a header name.
Even the original order that the songs were entered or date added or last played can be sorted.
Much easier with a mouse or touch pad. -
i got problem with volume of calls...its on max and i still can hear person on other side really bad...i got 4s
Did you fix the problem? I have the same problem and it has been pain in the neck.
-
hi..
i've got problem with my iphone 4s gsm factory unlocked it won't connect to a wifi. i tried to hold the power and home button even reset the network setting but ended with i am not even can turn the wifi on. does any body can helpme?See this: http://support.apple.com/kb/TS1559
If you carefully follow all of the instructions in this tip and none of them restore WiFi then your radio chip has failed and you need to get the phone replaced by Apple. -
Hi all, I got problem with my Safari!?
Hi all, I got problem with my Safari, same with Google Chrome, when trying to block pops-up. It's already ticked on BLOCK but everytime i click on new link, an annoyed pop-up appeared (game online, Mackeeper ...), any advice?
There is no need to download anything to solve this problem.
You may have installed the "Downlite" or "VSearch" ad-injection malware. Follow the instructions on this Apple Support page to remove it.
Back up all data before making any changes.
Malware is always changing to get around the defenses against it. In addition to, or instead of, the files listed in the support article, you may need to remove the following items:
/Library/Application Support/dot
/Library/LaunchAgents/com.dot.agent.plist
/Library/LaunchDaemons/com.dot.daemon.plist
/Library/LaunchDaemons/com.dot.helper.plist
/System/Library/Frameworks/v.framework
One of the steps in the article is to remove malicious Safari extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those. If Safari crashes on launch, skip that step and come back to it after you've done everything else.
If you don't find any of the files or extensions listed, or if removing them doesn't stop the ad injection, then you may have one of the other kinds of adware covered by the support article. Follow the rest of the instructions in the article.
The problem may have started when you downloaded and ran an application called "MPlayerX." That's the name of a legitimate free movie player, but the name is also used fraudulently to distribute VSearch. If there is an item with that name in the Applications folder, delete it, and if you wish, replace it with the genuine article from mplayerx.org.
This malware is often found on illegal websites that traffic in pirated content such as movies. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow. Never install any software that you downloaded from a bittorrent, or that was downloaded by someone else from an unknown source.
In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
Still in System Preferences, open the App Store or Software Update pane and check the box marked
Install system data files and security updates
if it's not already checked. -
Got problems with iOS7 and home sharing
Got problems with iOS7 and home sharing music. How do you home share music now. I don't have a airplay button either. It all work fine until I updated
I too am haing the same problem.
Oh i have an iphone 4 by the way - if this helps.
I have updated the itunes to 11 point something (latest as of 19th Sept '13) and still not joy.
My phone sees the network, then when i try to connect to it in the "Sharing" spot in music, it gives me the rotating icon and then i get "Unable to Home Share at this time".
I had this problem with the ios 6, which was log out of you apple account, and then turn off the phone -this was supposed to clear all the history and old connection details etc.
Then restart the phone and re-log into itunes account.
As i say - that worked last time, but this time, i have no idea what is going on.
I am looking at reverting back to the ios 6, and waiting for ios 7.1 which to be honest - wont be long away with the amount of issues people are having. -
I'm frustrated, I am doing everything you recommend, I use only two channels, have plenty of memory in my hard disk, and external hard drive, no effects, and still having problems with Garage band. Giving messages as you ave too many live channels, the disk is slow prepare...can you help?
Quote from: Richard on 15-November-07, 20:33:05
tornado2003,
What you need to do is boot into Safe Mode. Then delete the VGA Drivers.
After that boot normally and install the latest nVidia ForceWare Drivers
Take Care,
Richard
i guess you missed that:
Quote from: tornado2003 on 15-November-07, 17:26:52
ive tryed booting xp in safe mode but it just freezes after it loads up a couple of needed files .
ive even formatted my hard drive and tryed installing a fresh xp on it but it just keeps locking up when it gets to the "starting windows setup" .(this is just after it loads all the drivers from the xp cd) -
I have got problem with my pc-cam 950 slim
I have got problem with my pc-cam 950 slim. When I press the power button, the busy light goes on for seconds then it is shut down again so the camera doesn't work. Please help me with this problem. I tried to connect it to my PC put it didn't work either.
Thank you for taking the time to help me.Originally Posted by Colin-CL
Hi,
Have you checked that you have put in brand new 2 x AAA batteries?
Connecting it to your PC will allow you to use it as a mass storage device after installing the relevant operating system (Microsoft
hi,
Yes, I put two new batteries
When connected to the computer nothing happens
What can be done to reset it?
By replaced capacitor problem can be solved? -
Hi. I have got problem with my ITunes. Every time I´m opening the program I´ve got the message: One unkwown problem is appering (-42032) Can anybode please tell me what to do wit this error? Thanks
Gary,
discussions may sometimes be slow for an hour or so (at which point the opening page of discussions will eventually apologize for the inconvenience, back on line soon...) but your description looks like a cache problem.
Try OnyX freeware to do some cleanup and see if that helps.
http://www.titanium.free.fr/index.html
Maybe you are looking for
-
Hi, are there any binary operations in Java like '&' in C? I didn't found any information in the API description. Thank u.
-
Day wise Closing stocks for the given month
Hi, Please suggest me your valuable ideas for Closing Stocks Calender day wise for the given month. Ex : User Input 03.2013 , now report has to show daywise closing stock like below 01.03.2013 140 MT
-
R/3 To APO , customized material master data Transfer
Hello All, i am having an issue , that we need to add two customized fields (PUP price and Std Price) in /SAPAPO/MAT1, Extra Tab. i have added these fields on screen and the output structure for them is assigned as /SAPAPO/MATIO-zverpr, and /SAPAPO/M
-
Emacs compiled with S/MIME support in Arch Linux
I have been trying without success to get Emacs 23.2 and Gnus 5.13 in Arch Linux to generate messages signed with S/MIME certificates, which are frequently used by the U.S. government and by businesses. My configuration works fine on my Ubuntu works
-
Fonts for scrolling up text / ramp up ramp down?
Couple of questions regarding LiveType. I'm creating a credits for the end of a project that goes on for a couple of minutes, and is fairly slow. I selected a font I liked (a system font, not a LifeFont) and included a couple of symbols from Webdings