XPath in JDK1.4 - Please help
Hi There,
Can some one help me with the code for XPath in JDK1.4.2 I have a scenario where I would get the XML Message from Tibco EMS Message as a String. I should parse the XML into a PL/SQL Record type. i.e., Each of the Name/Value tags below would become a Column and Value for PL/SQL Record type.
If you have a better approach please advice.
Below is the XML I would get from EMS Message.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns="http://emsapp/InvoiceOrderStatusNotification">
<SOAP-ENV:Body>
<invoiceOrderStatusNotification>
<invoiceOrderStatusNotificationMessage>
<sourceSystem>
<sourceSystemType>Invoice Order Manager</sourceSystemType>
<sourceSystemId>INVOICE-APP</sourceSystemId>
</sourceSystem>
<alternativeIdentifiers>
<alternativeIdentifier>
<name>invoiceNumber</name>
<value>0312345678</value>
</alternativeIdentifier>
<alternativeIdentifier>
<name>orderNumber</name>
<value>12345678</value>
</alternativeIdentifier>
</alternativeIdentifiers>
<characteristics>
<characteristic>
<name>invoiceDateTime</name>
<value>20120613123625</value>
</characteristic>
<characteristic>
<name>invoiceMethod</name>
<value>MAN</value>
</characteristic>
</characteristics>
</invoiceOrderStatusNotificationMessage>
</invoiceOrderStatusNotification>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Please help, thanks in advance.
PS: I have to achieve it in JDK1.4.2 as my produciton is currently running on JDK1.4.2 :(
Edited by: user10177353 on Jul 29, 2012 2:35 AM
Where is the code which you need help with? All I see is some XML and a description which doesn't quite seem to describe the XML you posted. There's no XPath code anywhere to be seen.
Similar Messages
-
Xpath problems...please help
Hi:
i m new to xpath. i am trying to use xpath to select data from xhtml.Can i know how can select only one of the child ? take for example:
- <table border="0" cellpadding="2" width="100%">
+ <tr>
+ <tr>
+ <tr>
+ <tr>
- <tr>
<td>Number of Kids</td>
- <td>
1
- <small>
Profile History
</small>
</td>
</tr>
+ <tr>
i only wan to get the info number of kids, so is 1. The xpath syntax that i put is ......tr[5]/td[2] but it give me all the children under td[2].....can anyone plz help?
thank youhi emily_spt
i m also doing the same project which converts html to xml in order to extract data.... from this website.:
http://www-106.ibm.com/developerworks/web/library/wa-wbdm/
i m not able to compile the programs XMLHelper.java and the other .
can u plz illustrate the steps u had done to run the ..
plzzzzzzzz reply as soon as possible -
XPath - how to get non exist nodes? please help!
Hi!
There is a so xml structure:
main_node
node_a
node_a_1
node_a_2
node_a_3
the 'node_a' node repeats 3times in the XML. The 'node_a_2' node is not in the first recurrence of 'node_a' node.
When I want to get the 'node_a_2' nodes by XPath, I get a List, which consists of 2 element.
But I want to get a so list, which consists of 3 elements, the first is null and the others are the elements of 'node_a_2' node!
This is the code:
List getElementByXPath(String Path) throws org.jaxen.JaxenException {
org.jaxen.XPath P = new org.jaxen.jdom.JDOMXPath("/"+Path.replace(".","/"));
List Back = P.selectNodes(ArrivedXML.getRootElement());
return Back;
Please help, how can i do it!
Thank You very much!
rflairthe structure again...:
main_node
....node_a
........node_a_1
........node_a_2
........node_a_3 -
I suppose it is the problem with socket connection,Please help
Hi,
I'm trying to build a chat server in Java on Linux OS.I've created basically 2 classes in the client program.The first one shows the login window.When we enter the Login ID & password & click on the ok button,the data is sent to the server for verification.If the login is true,the second class is invoked,which displays the messenger window.This class again access the server
for collecting the IDs of the online persons.But this statement which reads from the server causes an exception in the program.If we invoke the second class independently(ie not from 1st class) then there is no problem & the required data is read from the server.Can anyone please help me in getting this program right.I'm working on a p4 machine with JDK1.4.
The Exceptions caused are given below
java.net.SocketException: Connection reset by peer: Connection reset by peer
at java.net.SocketInputStream.SocketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:119)
at java.io.InputStreamReader$CharsetFiller.readBytes(InputStreanReader.java :339)
at java.io.InputStreamReader$CharsetFiller.fill(InputStreamReader.java:374)
at java.io.InputStreamReader.read(InputStreamReader.java:511)
at java.io.BufferedReader.fill(BufferedReader.java:139)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at Login.LoginData(Login.java:330)
at Login.test(Login.java:155)
at Login$Buttonhandler.actionPerformed(Login.java:138)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1722)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:17775)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4141)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:253)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:261)
at java.awt.Component.processMouseEvent(Component.java:4906)
at java.awt.Component.processEvent(component.java:4732)
at java.awt.Container.processEvent(Container.java:1337)
at java.awt.component.dispatchEventImpl(Component.java:3476)
at java.awt.Container.dispatchEventImpl(Container.java:1399)
at java.awt.Component.dispatchEvent(Component.java:3343)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3302)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3014)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2967)
at java.awt.Container.dispatchEventImpl(Container.java:1373)
at java.awt.window.dispatchEventImpl(Window.java:1459)
at java.awt.Component.dispatchEvent(Component.java:3343)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:439)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:131)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
My program looks somewhat like this :
1st class definition:
public class Login extends Jframe// Login is the name of the first class;
Socket connection;
DataOutputStream outStream;
BufferedReader inStream;
Frame is set up here
public class Buttonhandler implements ActionListener
public void actionPerformed(ActionEvent e) {
String comm = e.getActionCommand();
if(comm.equals("ok")) {
check=LoginCheck(ID,paswd);
test();
public void test() //checks whether the login is true
if(check)
new Messenger(ID);// the second class is invoked
public boolean LoginCheck(String user,String passwd)
//Enter the Server's IP & port below
String destination="localhost";
int port=1234;
try
connection=new Socket(destination,port);
}catch (UnknownHostException ex){
error("Unknown host");
catch (IOException ex){
ex.printStackTrace ();
error("IO error creating socket ");
try{
inStream = new BufferedReader(new InputStreamReader(connection.getInputStream()));
outStream=new DataOutputStream(connection.getOutputStream());
}catch (IOException ex){
error("IO error getting streams");
ex.printStackTrace();
System.out.println("connected to "+destination+" at port "+port+".");
BufferedReader keyboardInput=new BufferedReader(new InputStreamReader(System.in));
String receive=new String();
try{
receive=inStream.readLine();
}catch(IOException ex){ error("Error reading from server");}
if(receive.equals("Logintrue"))
check=true;
else
check=false;
try{
inStream.close();
outStream.close();
connection.close();
}catch (IOException ex){
error("IO error closing socket");
return(check);
// second class is defined below
public class Messenger
Socket connect;
DataOutputStream outStr;
BufferedReader inStr;
public static void main(String args[])
{ Messenger mes = new Messenger(args[0]);}
Messenger(String strg)
CreateWindow();
setupEvents();
LoginData(strg);
fram.show();
void setupEvents()
fram.addWindowListener(new WindowHandler());
login.addActionListener(new MenuItemHandler());
quit.addActionListener(new MenuItemHandler());
button.addActionListener(new Buttonhandle());
public void LoginData(String name)
//Enter the Server's IP & port below
String dest="localhost";
int port=1234;
int r=0;
String str[]=new String[40];
try
connect=new Socket(dest,port);
}catch (UnknownHostException ex){
error("Unknown host");
catch (IOException ex){
ex.printStackTrace ();
error("IO error creating socket ");
try{
inStr = new BufferedReader(new InputStreamReader(connect.getInputStream()));
outStr=new DataOutputStream(connect.getOutputStream());
}catch (IOException ex){
error("IO error getting streams");
ex.printStackTrace();
String codeln=new String("\n");
try{
outStr.flush();
outStr.writeBytes("!@*&!@#$%^");//code for sending logged in users
outStr.writeBytes(codeln);
outStr.write(13);
outStr.flush();
String check="qkpltx";
String receive=new String();
try{
while((receive=inStr.readLine())!=null) //the statement that causes the exception
if(receive.equals(check))
break;
else
str[r]=receive;
r++;
}catch(IOException ex){ex.printStackTrace();error("Error reading from socket");}
catch(NullPointerException ex){ex.printStackTrace();}
} catch (IOException ex){ex.printStackTrace();
error("Error reading from keyboard or socket ");
try{
inStr.close();
outStr.close();
connect.close();
}catch (IOException ex){
error("IO error closing socket");
for(int l=0,k=1;l<r;l=l+2,k++)
if(!(str[l].equals(name)))
stud[k]=" "+str[l];
else
k--;
public class Buttonhandle implements ActionListener
public void actionPerformed(ActionEvent e) {
//chat with the selected user;
public class MenuItemHandler implements ActionListener
public void actionPerformed(ActionEvent e)
String cmd=e.getActionCommand();
if(cmd.equals("Disconnect"))
//Disconnect from the server
else if(cmd.equals("Change User"))
//Disconnect from the server & call the login window
else if(cmd.equals("View Connection Details"))
//show connection details;
public class WindowHandler extends WindowAdapter
public void windowClosing(WindowEvent e){
//Disconnect from server & then exit;
System.exit(0);}
I�ll be very thankful if anyone corrects the mistake for me.Please help.You're connecting to the server twice. After you've successfully logged in, pass the Socket to the Messenger class.
public class Messenger {
Socket connect;
public static void main(String args[]) {
Messenger mes = new Messenger(args[0]);
Messenger(Socket s, String strg) {
this.connect = s;
CreateWindow();
setupEvents();
LoginData(strg);
fram.show();
} -
I am having a problem installing the JDK Software. Please Help
Please help I am Having trouble installing my JDK software. I tried to make a simple program saying Hello World and the program fails to work because it can not find my class.
C:\Jfiles\DIR
ILoveJava.java
ILoveJava.class
C:\Jfiles\Javac ILoveJava.java
C:\Jfiles\Java ILoveJava
Exception in thread "main" Java.lang.NoclassDeffounderror
The Path seems to be set correctly because the Javac compiled.
I have tried a number of different ClassPath Definitions like C:\JDK.14\Lib\Tools.jar and ClassPath=.;C:\JDK.14\Lib\Tools.jar and ClassPath=. and ClassPath=
I made sure that the capitilization and the spelling was the same between the ILoveJava I specified in notepad and the program name.
I am also having trouble with JBuilder, Eclispe and NetBeans with finding Classes.
Another error that I received after I changed the ClassPath to ClassPath= .;C:\JDK1.4\bin\ was a
nosuchmethod error, When I tried to run the program I made using Java ILoveJava.
Is their any other problem like a conflict of some sort that could be causing this problem?
Could the problem be anything besides the ClassPath and Path Settings?
Please, help me? I really, really, need to learn Java. Thank You.
Java -Version
Java Version 1.4.2.
Windows XPHi all,
Sylonious, did you manage to sort this problem out? I have been experiencing similar problems. I think my problem was because I had many different versions of JDKs. I have done a complete re-install. I would be really grateful to you (and anyone else) for help with this problem.
I have re-installed JSDK1.4.2_03, set the "path" variable to "C:\JSDK1.4.2_03".
When I compile using "javac" I get an error saying "javac" is not recognised.
When I compile using "C:\j2sdk1.4.2_03\bin\javac Freq.java" no error is thrown.
Every time I try to run a java file, I always get the NoClassDefFound error. When run with the -verbose option, files are loaded from C:\Program Files\Java\j2re1.4.2_03\bin - is this correct?
I have removed all previous references to java in the registry editor.
Please help !
Regards,
Vipul -
XML Data Set with Spry Slides - Please Help
Hi, I'm trying to combine XML Data Set with sliding tabs.
I've created two keys responsible for sliding the tabs:
<a id="previous" href="#"
onclick="sp1.showPreviousPanel();">Previous</a>
<a id="next" href="#"
onclick="sp1.showNextPanel();">Next</a>
Then XML Data Set is used to populate the tabs, but only a
single tab remains visible, and a "Next/Previous" buttons are used
to move to the next tab. And this is where the problem arises.
The problem is that, every time I refreash the gallery or
load it for the first time, I have to press TWICE the "Next" button
to move to the next image. After that, its all fine, and slides
well. It's only the FIRST time when loaded.
Please help.
Here's the full code:
<div id="images_gal" >
///////////////////////////////////////// The menu - the
culprit///////////////////////////////////////////
<div id="menu_next">
<a id="previous" href="#"
onclick="sp1.showPreviousPanel();">Previous</a>
<a id="next" href="#"
onclick="sp1.showNextPanel();">Next</a>
</div>
//////////////////////////////////////// The Sliding Panels
Gallery ////////////////////////////////////////////////////
<div id="example2" class="SlidingPanels" tabindex="0" >
<div class="SlidingPanelsContentGroup"
spry:region="dsSpecials">
<div spry:repeat="dsSpecials" id="{first}"
class="SlidingPanelsContent{second}"><div class="top_gal"
></div><div class="main_gal"><img
src="images/Galery/{third}" alt="Digital_Signage" width="600"
height="304" />
<p class="screen_gal"><a href="#"
onclick="MM_openBrWindow('film1.html','Coloris','width=340,height=260,
top=250, left=250')">CLICK TO VIEW</a></p>
</div><div
class="bottom_gal"></div></div>
</div>
</div>Anyone has any idea why I need a DOUBLE Click to start moving
the sliding panels?
I've just completed two tutorials by Don Booth.
1/Building a Spry Sliding Panels widget
2/Building a photo album with the Spry framework
But what I try to COMBINE them - display the photos in
sliding panels, I also need to DOUBLE click the "next" buton before
it starts scrolling.
Why is that Double Click needed? Help Please.
Here's my code for the combined version:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
a {
position:relative;
left:23px;
top:127px;
z-index:10000;
color: #FF0000;
</style>
<script type="text/javascript"
src="photo_album_samples/includes/xpath.js"></script>
<script type="text/javascript"
src="photo_album_samples/includes/sprydata.js"></script>
<script type="text/javascript"
src="Spry/SprySlidingPanels.js"></script>
<link type="text/css" rel="stylesheet"
href="Spry/SprySlidingPanels.css">
</head>
<body>
<div >
<a href="#" onclick="sp1.showPreviousPanel();">Previous
Panel</a>
<a href="#" onclick="sp1.showNextPanel();" >Next
Panel</a>
</div>
<div id="panelwidget" class="SlidingPanels" >
<div class="SlidingPanelsContentGroup"
spry:region="dsGallery" >
<div spry:repeat="dsGallery" class="SlidingPanelsContent"
id="p1"><img
src="photo_album_samples/thumbnails/{@thumbpath}"/></div>
</div>
</div>
<script type="text/javascript">
var dsGallery = new
Spry.Data.XMLDataSet("photo_album_samples/photos.xml",
"gallery/photos/photo");
</script>
<script type="text/javascript">
var sp1 = new Spry.Widget.SlidingPanels("panelwidget");
</script>
</body>
</html> -
How to call communication channel dynamically? Please help!
Hi Experts,
BizTalk -
> XI -
> SAP SYS01
XI|----
>SAP SYS02
We are integrating Biztalk with SAP via XI. BizTalk send rosattenet PIP via JMS adapter to XI. XI then sends the PIP data to SAP system using RFC adapter.
In the PIP we have a parameter for plant code. Now if plant code is 'ABC' then we need to send the data to SAP SYS01 else if plant code is 'XYZ' then send the data to SAP SYS02.
In other words we have RFC communication channel one each for each SAP system.
This is like calling the communication channel dynamically based on palnt code.
How can we do this in XI? Please help!
Thanks & Regards,
Gopal
Edited by: GOPAL BALIGA on Jan 12, 2009 7:35 AMthis is a typical case for a XPATH based conditional routing. note that your receiver will have binding with the interface and the communication channel
ref:
/people/shabarish.vijayakumar/blog/2005/08/03/xpath-to-show-the-path-multiple-receivers
/people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination -
Java command still not working - please help
i have installed jdk1.6.0_05. The javac command works fine but the java command does not work at all. even when i try java HelloWorld i receive this exception message
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
please help (you to SUN)!!bart@kerberos:~$ javac -help
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files and annotation processors
-cp <path> Specify where to find user class files and annotation processors
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-proc:{none,only} Control whether annotation processing and/or compilation is done.
-processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process
-processorpath <path> Specify where to find annotation processors
-d <directory> Specify where to place generated class files
-s <directory> Specify where to place generated source files
-implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-Akey[=value] Options to pass to annotation processors
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime systemSee the bold part.
More information: [http://java.sun.com/docs/books/tutorial/java/package/managingfiles.html] -
XML parsing error where none should be...please help!
From Oracle 10g, I am calling web service running in ASP.NET 1.1 on IIS 6.0 to print a document and return a simple 'PRINTED' message via soap.
The SOAP message I'm back from the web service is simply this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<PrintBOLResponse xmlns="http://tempuri.org/">
<PrintBOLResult>PRINTED</PrintBOLResult>
</PrintBOLResponse>
</soap:Body>
</soap:Envelope>
And the code and XPATH I am using to extract the message is:
-- Remove the <?xml version="1.0" encoding="utf-8"?> header
soap_respond := SUBSTR (soap_respond, 39, 10000);
-- Create an XMLType variable containing the Response XML
resp := XMLTYPE.createxml (soap_respond);
-- Attempt to extract the message that should be returned by the web service
resp := resp.EXTRACT ('/soap:Envelope/soap:Body/*/*/child::node()');
And it gives me this error:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00601: Invalid token in: '/soap:Envelope/soap:Body/*/*/child::node()
When I test it out here: http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm
it parses just fine, and I cannot find any useful information on this LPX-00601 error.
Please help?I'm sorry, the full response from the web service is:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<soap:Body>
		<PrintBOLResponse xmlns="http://tempuri.org/">
			<PrintBOLResult>PRINTED</PrintBOLResult>
		</PrintBOLResponse>
	</soap:Body>
</soap:Envelope> -
Javax.servlet.* Not Found Error - Please help
I am having a great deal deal of trouble trying to compile a program using javax.servlet and javax.servlet.hhtp.*. I have setup the JAVA_HOME and the CLASSPATH variables as per the Installation instructions. I appear to have hit a brick wall and I am absolutely desperate to get this working. I have installed the J2EE SDK as well as the Servletapi2.1. Please Help.
Variables:
CLASSPATH=c:\jdk1.3\lib\tools.jar;c:\j2sdkee1.3.1\lib\j2ee.jar;c:\jdk1.3\jre\bin;c:\jdk1.3\jre\lib;c:\mm.mysql-2.0.14\org;c:\jdk1.3\lib\servlet.jar;
JAVA_HOME=c:\jdk1.3;
J2EE_HOME=c:\j2sdkee1.3.1;
PATH=%PATH%;c:\jdk1.3\bin;c:\j2sdkee1.3.1\bin;
Error message from compiler:
L:\PROGRA~1\allaire\jrun\servers\default\loanstest\web-inf\classes\PasswordServlet.java:27: package javax.servlet does not exist
import javax.servlet.*;
^
L:\PROGRA~1\allaire\jrun\servers\default\loanstest\web-inf\classes\PasswordServlet.java:30: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
L:\PROGRA~1\allaire\jrun\servers\default\loanstest\web-inf\classes\PasswordServlet.java:39: cannot resolve symbol
symbol : class HttpServlet
location: class PasswordServlet
public class PasswordServlet extends HttpServletI can only think of three suggestions.
One, use your mouse to "cut-n-paste" the value of CLASSPATH and verify that those files are exactly where you think they are, and are spelled right.
E.g.
CD C:\JDK1.3\LIB
DIR SERVLET.JAR
Two, if they're spelled right, run "jar tvf" on the files to make sure they aren't corrupted or something.
E.g.:
JAR TVF SERVLET.JAR
Three, since you're working in Windoze, try putting the value inside double quotes. E.g.:
SET CLASSPATH="c:\jdk1.3\lib\tools.jar;c:\j2sdkee1 ... etc ... "
If you haven't tried the above, give it a go, see what happens. -
Problem compiling my first program; Please Help me!
Please HELP, what am I doing wrong?
For over 5hours I have been trying to figure out how to compile a simple Hello world program using sdk1.3.1_02/j2re1.3.1_02 and I am getting the following errors: helloworld.java:2 cannot resolve symbol
symbol : class string
location : class helloworld
cannot reolve the string symbol
symbol : class out
location : package system
I want to program in java so badly but I am trying to get my environment set so that I can take off. To compile my first program has been a disaster!!
This is my path:
SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JDK1.3.1_02\BIN
Thanks very much in advance
::(Java is case sensitive,
use String instead of string. and System.out instead of system.out
Sudha -
Very urgent : please help !!!! Blowfish problem
Greetings people,
I have devised an application which reads the value from file and encrypts it (using Blowfish)......The file is then read and decrypted accordingly..............
Problem : I seem to be able to encrypt and further decrypt file(s) which size is below 100 bytes. Anything beyond that will trigger the following :
javax.crypto.IllegalBlockSizeException: Input length (with padding) not multiple of 8 bytes
at com.sun.crypto.provider.SunJCE_h.a(DashoA6275)
at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
at com.sun.crypto.provider.BlowfishCipher.engineDoFinal(DashoA6275)
at javax.crypto.Cipher.doFinal(DashoA6275)
at LockDownBase.decrypt(LockDownBase.java:144)
Could someone please help me with this dilemma as time is of the essence at this point and I really need to get this thing up and running. (ps. It is necessary for me to retain the usage of the Base64 Encoder as I am conducting a study on the usage of this Encoder).
Thank you for the help
<code>
import java.io.*;
import java.math.*;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import sun.misc.*;
public class LockDownBase {
private static String keyFile = "c:\\encode\\blowfishbase.txt";
public static String new_key (String me) throws Exception {
//Get a blowfish key
KeyGenerator keyGenerator = KeyGenerator.getInstance("Blowfish");
keyGenerator.init(128);
SecretKey key = keyGenerator.generateKey();
System.out.println("OK");
byte [] encoded = key.getEncoded();
FileOutputStream fos = new FileOutputStream(keyFile);
fos.write(encoded);
fos.close();
return me;
//initKey
public static Key initKey() throws Exception{
FileInputStream in = new FileInputStream(keyFile);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int i;
while((i=in.read()) != -1){
baos.write(i);
in.close();
byte [] keys = baos.toByteArray();
SecretKeySpec key = new SecretKeySpec(keys,"Blowfish");
Key keyword = key;
return key;
public static String encrypt (String location) throws Exception{
//PrintStream is deprecated, but works fine in jdk1.1.7b
//PrintStream output1 = new PrintStream(outFile1);
//get_key
String testme = "dummy";
Key key = initKey();
Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, key);
// read in the input file
String line;
StringBuffer buffer = new StringBuffer();
FileInputStream fis = new FileInputStream(location);
InputStreamReader isr = new InputStreamReader(fis);
Reader in = new BufferedReader(isr);
int ch;
while ((ch = in.read()) > -1) {
buffer.append((char)ch);
in.close();
line = buffer.toString();
byte [] cipherText = cipher.doFinal(line.getBytes("UTF8"));
//output1.print(" ");
// output1.println("ciphertext.length = " + cipherText.length);
// print out representation of ciphertext to general output file
BASE64Encoder encoding = new BASE64Encoder();
String feed = encoding.encode(cipherText);
FileOutputStream outFile2 = new FileOutputStream(location);
PrintStream output2 = new PrintStream(outFile2);
output2.close();
String dir = location;
FileOutputStream outFile3 = new FileOutputStream(dir);
PrintStream output3 = new PrintStream(outFile3);
output3.println(feed);
output3.close();
return location;
public static String decrypt (String location) throws Exception{
Key key = initKey();
String line;
String dir = location;
FileReader far = new FileReader (dir);
BufferedReader stdin = new BufferedReader(far,8192);
String line = null;
while ((line = stdin.readLine()) != null){
BASE64Decoder decoding = new BASE64Decoder();
byte[] decrypted = decoding.decodeBuffer(line);
Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, key);
byte [] decryptedtext = cipher.doFinal(decrypted);
String output = new String (decryptedtext,"UTF8");
System.out.println(output);
FileOutputStream outFile1 = new FileOutputStream(location);
PrintStream output1 = new PrintStream(outFile1);
output1.println(output);
output1.close();
return location;
</code>The error message says it all.
Input length (with padding) not multiple of 8 bytes
As you are using PKCS5Padding you will have an output data whose length is padded with 1 a 8 bytes. For instance, if your original data have 1023 bytes, it is padded with 1 byte - total length = 1024. It your original data have 1024 bytes, it will be padded with 8 bytes (not 0 as you could think).
You have some problem encoding and decoding Base-64 - it is not yielding the original encrypted results. Your best friend is System.out.println of the length of the original and encrypted data. -
J2EE doesn't run...PLEASE HELP!!
When I try to run j2ee from my console I get the following message:
Fatal Error: This J2EE SDK release runs only on Java 2 (JDK1.2 or later)
I have j2sdk1.4.1_01 already installed so I don't understand why i get this error message.
I have also set all my paths as follows:
Path=C:\Program Files\j2sdk1.4.1_01\bin;C:\Program Files\j2sdkee1.2.1\bin;C:\Program Files\j2sdkee1.2.1\ant\bin
J2EE_HOME=C:\Progra~1\j2sdkee1.2.1
JAVA_HOME=C:\Progra~1\j2sdk1.4.1_01
I also removed any references in my path to older jdk's. can someone please help me out and tell me what i am doing wrong.
Thanks.Hmmmm...
ssniazi does nothing but ask for contact information or recommend Oracle products.
Based on this I consider it likely that this person is some sort of sales representative either directly or indirectly associated with Oracle.
I personally wouldn't provide any contact information to this person. Nor would I accept any advice until this person starts to actually provide some solutions or at least correctly reveals any financial interests that they might have. -
OCI DRIVER error. Please help me!!!
Hi there,
I am trying to connect to oracle 9.0.1 database that is on server, not on my system. I am using JDBC for conncetion. I want to use OCI driver but it gives me "java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path"
I have jdbc driver jar zip & jar file saved on hard drive and also they are included in CLASSPATH.
Please help me out to solve this.
n I am using Tomcat 5.0, jdk1.4.1, win xp.
Thanks,Hi Vikas,
For running the application with the OCI driver, the system should have the Oracle database or Oracle database client installed. Also, ensure that the following environment variables are set:
On Windows, ensure the following:
i) ORACLE_HOME\lib directory is in the PATH
ii) ORACLE_HOME\bin directory is in the PATH
After performing the above mentioned things, try again.
Thanks
-shefali -
Installation problem - urgent, PLEASE help!!
I'm trying to install Java3D and somehow it doesn't seem to be working. I'm not sure whether I should be installing the opengl or the
directx version, but I've tried both with no luck. I'm running Windows
M.E.
I downloaded the JSDK beta 1.4 version (I have previously tried also
with the 1.3 version, this didn't work either), and now have the
jdk1.3.1 as a folder on my C drive ( C:\jdk1.3.1) . Then I downloaded
Java3D from the website, onto C, as an executable file. When I clicked
it, it went through the installation process (not giving me any
options for where to install it, i was just clicking on 'next') and
seemed to complete ok, but I'm trying to test it by running the
helloUniverse demo, and the file isn't even there. There's a Java3D
folder which has been created in Windows, but this just contains a
folder called uninstall_info.
On my Java plug-in control Panel, it is currently set to 'use java
plug-in default'. The other options are to use JRE or JDK, in folders
Program Files\JavaSoft or JDK1.3.1 respectively. I don't know which
one I should be choosing! I think I tried it with the JDK option
before and that didn't work either.
If anyone can please help I'd be really grateful, this is getting
quite urgent!Hi there!
Well, try installing java3d in the same directory as ur java(which is c:\jdk1.3.1 for u).
If i am not mistaken, java3d, by default, installs in c:\jdk1.2.2 directory.
U also have 2 set the path and classpath in the autoexec.bat to addr to \bin and \lib sub-directories resp.
Maybe you are looking for
-
How do I import music files to new computer from external hard drive containing them
Have an older computer(G5 iMac) with Tiger 10.4.11 and iTunes that crashed. Have that computer and older version of iTunes residing on an external hard drive. I want to import music to new comptuer with newer version of iTunes. External hard drive
-
Hello people, im sorry if this issue was talked about before, i did some research and i can't find the solution for this issue: i am using Premiere Pro CS4, Windows Vista64, 8GB RAM, i have a good audio card, when i first installed premiere, everythi
-
Time Machine not working in Bridge mode
I have a AE6400 setup in bridge mode. The reason that it is in bridge mode is because I have my apple backup hardware on the other side and I believe having it in a Firewall mode would not allow this to work ( at least not easily). I have a client on
-
File Manager Shows PC as 'Offline' - Unable to Access Files
Hello, Link is installed (latest version and has been reinstalled) on 2 PC's. Both show up on the file manager, but one is Offline. This only started recently. Have restarted everything, checkd the firewall and antivirus and but exlcusions for all BB
-
Merge Into works in SQL, fails in PL/SQL
Database is 9i (Oracle9i Enterprise Edition Release 9.2.0.5.0)<br> <br> The 9i documentation--PL/SQL User's Guide and Reference Release 2 (9.2)--makes it seem like this is part of the PL/SQL language, but the compiler disagrees.<br> <br> Anyone else