Java files and the Unicode!!!
how to read from a unicode(UTF) file in a java program
(give me an example please)
Use InputStreamReader and pass in the appropriate constructor arguments.
Drake
Similar Messages
-
Wsdlc Ant Task - Problem creating java files in the correct package
In eclipse, for weblogic 9.2
Using the wsdlc WebLogic Web Services Ant Task, I am trying to auto-generate the java files for the web service based on the WSDL. I have specified the packageName as one of the parameters. However the java files are being created and packaged based on the TargetNameSpace of the WSDL rather then under the package name specified. Following is part of my build.xml
autogen.src.dir=../code/java/beaAutoGen
base.dest=../../../var/build/wsmToPlmWS
bea.build.dir=beaBuild
<target name="generate-from-wsdl" depends="prepare">
<delete dir="${src.dir}" includeemptydirs="true" />
<delete dir="${autogen.src.dir}" includeemptydirs="true" />
<wsdlc srcWsdl="../config/sourceWSDL/MRPBindingPort.wsdl"
destJwsDir="${base.dest}/${bea.build.dir}/compiledWsdl" destImplDir="${base.dest}/${bea.build.dir}/impl"
packageName="com.lmco.iplm.webservices.wsmtoplm" debug="on"
srcServiceName="WSPlmMto_Service"
debugLevel="DEBUG" autoDetectWrapped="true" jaxRPCWrappedArrayStyle="true"
verbose="on" classpathref="bea-classpath" />
<!-- unjar to get the all the details so we can tokenize -->
<unjar dest="${autogen.src.dir}"
src="${base.dest}/${bea.build.dir}/compiledWsdl/MRPBindingPort_wsdl.jar" />
<!-- copy over the impl file -->
<copy todir="../code/java/src">
<fileset dir="${base.dest}/${bea.build.dir}/impl" />
</copy>
</target>In eclipse, for weblogic 9.2
Using the wsdlc WebLogic Web Services Ant Task, I am trying to auto-generate the java files for the web service based on the WSDL. I have specified the packageName as one of the parameters. However the java files are being created and packaged based on the TargetNameSpace of the WSDL rather then under the package name specified. Following is part of my build.xml
autogen.src.dir=../code/java/beaAutoGen
base.dest=../../../var/build/wsmToPlmWS
bea.build.dir=beaBuild
<target name="generate-from-wsdl" depends="prepare">
<delete dir="${src.dir}" includeemptydirs="true" />
<delete dir="${autogen.src.dir}" includeemptydirs="true" />
<wsdlc srcWsdl="../config/sourceWSDL/MRPBindingPort.wsdl"
destJwsDir="${base.dest}/${bea.build.dir}/compiledWsdl" destImplDir="${base.dest}/${bea.build.dir}/impl"
packageName="com.lmco.iplm.webservices.wsmtoplm" debug="on"
srcServiceName="WSPlmMto_Service"
debugLevel="DEBUG" autoDetectWrapped="true" jaxRPCWrappedArrayStyle="true"
verbose="on" classpathref="bea-classpath" />
<!-- unjar to get the all the details so we can tokenize -->
<unjar dest="${autogen.src.dir}"
src="${base.dest}/${bea.build.dir}/compiledWsdl/MRPBindingPort_wsdl.jar" />
<!-- copy over the impl file -->
<copy todir="../code/java/src">
<fileset dir="${base.dest}/${bea.build.dir}/impl" />
</copy>
</target> -
In our current application we have the following source directory structure:
src -
- com
- edeploy
- subdirs ... (many directories here)
- jsp
-subdirs ... (many directories here)
In com.edeploy.subdirs, there exists *.java files, and *.gxq files (query
files). I would like to modify my build.cmd script to copy the *.gxq files
into the same directory as the class files.
Here's my script so far:
@REM Create list of files to compile
DIR /S /B /A:-D src\com\*.java >class.list
@REM Create list of query files
DIR /S /B /A:-D src\com\*.gxq >query.list
@REM Compile
javac -d stage\WEB-INF\classes @class.list
@REM Copy query files into class directory
.......... code needed here ......
Can anyone help me with this?
Thanks,
Matt
You may want to check out:
http://jakarta.apache.org/ant/index.html
Gary
"Matt Raible" <[email protected]> wrote in message
news:[email protected]..
> In our current application we have the following source directory
structure:
>
> src -
> - com
> - edeploy
> - subdirs ... (many directories here)
> - jsp
> -subdirs ... (many directories here)
>
>
> In com.edeploy.subdirs, there exists *.java files, and *.gxq files (query
> files). I would like to modify my build.cmd script to copy the *.gxq
files
> into the same directory as the class files.
>
> Here's my script so far:
>
> @REM Create list of files to compile
> DIR /S /B /A:-D src\com\*.java >class.list
>
> @REM Create list of query files
> DIR /S /B /A:-D src\com\*.gxq >query.list
>
> @REM Compile
> javac -d stage\WEB-INF\classes @class.list
>
> @REM Copy query files into class directory
> .......... code needed here ......
>
> Can anyone help me with this?
>
> Thanks,
>
> Matt
>
>
-
How to compile other java files and run them from my own programs?
I'm developing a unit testing tool for AspectJ, which can originally generate the stubs for aspect unit to be tested. All these stubs are java files. After generation of stubs, how can I program the code to compile this unit together with these stubs, i.e. how can I put the functionality of compilation and run, e.g. command "javac *.java" and "java *", into my own code.
Hope you can understand what I mean.
Thank you in advance.When I use Runtime.getRuntime().exec(command) for executing the AspectJ compile command "ajc", "IOException createProcess error=2" always occurs, while it is ok for Java comiple command "javac".
Why this happens when I use Runtime.getRuntime().exec("ajc Hello.java Test.aj")? Is it the reason that Runtime.exec(String) may not support any command in DOS?
(ajc is the compile command for the java file and aj file.)
Thank you in advance. -
I am to create a link verification program -- a simple java file with the database connection & some business logic and a JSP page that instantiates the my java file. It won't work. Everytime I run the jsp page, it gives me java.lang.NullPointerException. Can anyone give me some directions? The web server I am using is JRun.
Thank you
Below are my code:
JSP Page:
<%-- Verify Links
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import="java.sql.*" %>
<%@ page import="java.net.*" %>
<%@ page import="pro.*" %>
<html>
<head>
<title>Results</title>
</head>
<body>
<%
try{
LinkConnection newconn = new LinkConnection();
newconn.initialize();
newconn.query();
newconn.close();
}catch (ClassNotFoundException cnfe)
out.println(cnfe);
catch (SQLException sqle)
out.println(sqle);
catch (NullPointerException npe)
out.println(npe);
%>
</body>
</html>
Java Code:
package pro;
import java.io.*;
import java.sql.*;
import java.net.*;
public class LinkConnection {
Connection con;
ResultSet RS;
Statement Stmt;
public void initialize() throws SQLException, ClassNotFoundException
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("XXXX", "XXXX", "XXXX");
public void query() throws SQLException
Statement Stmt=con.createStatement();
String strSQL="Select guideline_name, guideline_url from pgt_guidelines";
ResultSet RS=Stmt.executeQuery(strSQL);
while (RS.next())
String guidelinename = RS.getString("guideline_name");
String guidelineurl = ("http://" + RS.getString("guideline_url"));
try {
URL url = new URL(guidelineurl);
HttpURLConnection link=(HttpURLConnection)url.openConnection();
System.out.println("<font color='blue'>");
System.out.println(guidelinename);
System.out.println("<br>");
System.out.println(guidelineurl);
System.out.println("</font>");
System.out.println("<font color='red'>");
System.out.println(link.getResponseCode());
System.out.println("</font>");
System.out.println("<br />");
}catch (Exception e)
{System.out.println("<font color='yellow'>Error Link </font>")
public void close() throws SQLException {
RS.close();
Stmt.close();
con.close();i'm having the same problem, what is the solution to this
A Servlet Exception Has Occurred
java.lang.NullPointerException
at test.Lesson.runSql(Lesson.java:80)
===== Lesson.java file =====
package test;
import java.sql.* ;
import java.io.Serializable;
public class Lesson {
public Lesson( ) { }
//Line 9
public String runSql ( ) {
String browserOutput = "";
Connection sqlca = null;
Statement sqlStatement = null;
ResultSet myResultSet = null;
//Line 16
/* Connect to database, run SQL and produce output */
try {
/* Connection to the database */
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String theDatabase ="jdbc:mysql://localhost/employee";
sqlca = DriverManager.getConnection(theDatabase,"usr","pwd");
//Line 24
/* Construct and execute the sql, positioning before the
first row in the result set */
sqlStatement = sqlca.createStatement();
myResultSet = sqlStatement.executeQuery
//Line 29
("select emp_id, " +
"emp_lname, " +
"city, " +
"state," +
"zip_code, " +
"emp_fname " +
"from employee " +
"where emp_id < 250 " +
"order by emp_lname, emp_fname");
//Line 39
/* Construct the heading for the table */
browserOutput =
"<div align=left>"+
"<table border=0 align=left width=520>" +
"<caption><i><b>" +
"Employee Listing</b></i></caption>" ;
//Line 46
/* Construct the column headings for the table */
browserOutput +=
"<th align=left>Emp_id</th>" +
"<th>First Name</th>" +
"<th>Last Name</th>" +
"<th>City</th>" +
"<th>State</th>" +
"<th>Zip</th>" ;
//Line 55
/* Move to next row and & its contents to the html output */
while(myResultSet.next()) {
browserOutput += "<TR><TD>" +
myResultSet.getObject("emp_id").toString() + "</TD><TD>" +
myResultSet.getObject("emp_fname").toString()+"</TD><TD>" +
myResultSet.getObject("emp_lname").toString() + "</TD><TD>" +
myResultSet.getObject("city").toString() + "</TD><TD>" +
myResultSet.getObject("state").toString() + "</TD><TD>" +
myResultSet.getObject("zip_code").toString() + "</TD></TR>" ;
//Line 66
}//end of while
sqlStatement.close();
sqlca.close();
}//end of try
catch (SQLException e) {
//Line 72
browserOutput = " Error: SQLException: " + e.getMessage();
browserOutput= " Error: SQLState: " + e.getSQLState();
browserOutput= " VendorError: " + e.getErrorCode();
}//end of SQLException
catch (Exception e) {
browserOutput = " Error: JDBC Class creation: " + e.getMessage();
}//end of Exception
/**Line 80**/ finally {
try { sqlca.close(); }
catch(SQLException e) {
browserOutput = " Error: Closing connection: " + e.getMessage();
}//end of finally
/* Complete the html and return it to the Java Server Page */
browserOutput += "</table>" + "</div>" ;
return browserOutput;
} //end of runSql
}//end of Lesson -
How to run a remote windows dll files and the drivers of the system using j
Dear Friends,
I need some valuable info regd how to run a remote windows dll files and the drivers of the system using java
reply regd thanking youPlease don't make duplicate posts like this.
-
Java Files inside the jar file cannot be read or accessed through Eclpse
The Java File inside the jar file of the eclipse cannot be accessed through the Eclipse . It shows error for the modules in the jar file .
But when compiled with adding the jar files to the class path the compilation is successful .
How can i browse through the files in the jar like going into the function definition .
TIA ,
ImranOpen MPlayer OSX and show the playlist (command-shift-p) then drag the file into the playlist. Click the file in the playlist and click the "i"nfo button. What does it list for file, video and audio format?
Not all of the codecs used in avi and wmv files are available for OS X so I'm guessing your file happens to be using one that isn't... -
Create unicode file and read unicode file
Hi
How can create a unicode file and open unicode file in LV
Regards
Madhugmadhu wrote:
Hi
How can create a unicode file and open unicode file in LV
Regards
Madhu
In principle you can't. LabVIEW does not support Unicode (yet)! When it will officially support that is a question that I can't answer since I don't know it and as far as I know NI doesn't want to answer.
So the real question you have to ask first is where and why do you want to read and write Unicode file. And what type of Unicode? Unicode is definitly not just Unicode as Windows has a different notion of Unicode (16 Bit characters) than Unix has (32 Bit characters). The 16 Bit Unicode from Windows is able to cover most languages on this globe but definitly not all without code expansion techniques.
If you want to do this on Windows and have decided that there is no other way to do what you want you will probably have to access the WideCharToMultiByte() and MultibyteToWideChar() Windows APIs using the Call Library Node in order to convert between 8 bit multybyte strings as used in LabVIEW and the Unicode format necessary in your file.
Rolf Kalbermatter
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Reaching the java file outside the package?
Hi how can i reach the java(or class) files outside the packge(i mean one top folder)
For example i have a java file in a folder named tech and i want to reach a java file in the folder named support which is under tech folder is something like that possible if it is how?Then tech should also be in a package.
So it would be..
package tech;
import tech.support.*;and
package tech.support;
import tech.*; -
Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.The Oracle documentation has a good overview of the options available
Generating XML Data from the Database
Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
You can also find some information in XML DB FAQ -
Need Help ASAP my State tax form is in a PDF file and the attachment in my email says Please wait
Need Help ASAP my State tax form is in a PDF file and the attachment in my email says Please wait...
I tried downloading updates like it said to but it still will not display the document. How do I print the PDF file ASAPCan you give us a LOT more info?
What email client? What version of Reader (I can only assume you even have Reader at this point)?
Please wait? I'm sure it says more than that, right?
Have you tried simply saving the PDF (it IS a PDF correct?) to your desktop and opening it from there?
Did you get this form from the IRS or did it come from somewhere else? If the IRS again, what version of Reader?
Help us help you. -
I have dragged 2 files to the trash bin but I cannot delete them from the trash bin. It keeps telling me these files are in use when they are not. How do I delete these files? One is a txt file and the other is an xls file
From the Finder menu select 'Secure Empty Trash'. If this or the suggestion above doesn't resolve the problem take a look at the various suggestions in this link:
http://www.thexlab.com/faqs/trash.html -
I have a 1TB WD passport that currently contains windows files e.g photos, documents, etc. Can I partition it so that one partition contains these files and the other partition is used for time machine backups? Also, how do I change the partition system on the hard drive so that it uses the GUID partition system?
Thanks in advance.Yes, you can, though you need to format and partition the drive from the scratch.
1) back up your PC data on other drive.
2) partitioning your drive into 2 partitions with Disk Utility.
3) format one partition by Mac OS extended (journaling) for Time Machine, the other by exFAT for PC data.
4) restore PC data on exFAT partitioned drive. -
I converted aif files to mp3 files in iTunes so I could put them on a flash drive. Now when I transfer an album to the flash drive I get both the aif files and the mp3 files on the flash drive. How do I get the iTunes to only copy the smaller file?
My suggestion to use the smart playlist was more along the lines of making one list with rules to show everything in your library as long as it was kind "mpeg" (= mp3).
Smart playlists cannot be edited manually, only by changing the rules. You can use them as the basis for another smart playlist though.
There is added overhead to using smart playlists, so don't go overboard. -
How can I copy programs (iWorks) and files from Time Capsule to my HD manually? The problem is that the migration assistant does not recognize my backup file and the user on the TC. (If I open the TC on finder, it it there though)
How can I copy programs (iWorks) and files from Time Capsule to my HD manually? The problem is that the migration assistant does not recognize my backup file and the user on the TC. (If I open the TC on finder, it it there though)
Maybe you are looking for
-
Connecting to Windows machines by name doesn't work
OK. Here's the story. PC/Linux guy for a long time. I'm the default sysadmin at work and for family. My wife bought me a Mac for my birthday, and I LOVE IT !! The only problem is I still have 4 windows machines in the house, and I need to connect to
-
Hi lots going wrong with my music library, artwork is muddled up and also losing tracks because of this, also unable to download latest version of itunes and finally i cannot burn my music to disc. i have an external hard drive and a fairly large lib
-
How to save 130 length field in SAP BW system.
Hi all, In my source system a field contains 130 length.How to represent that field in BW.(I heard this can be Done using RRI ). If anyone knows please explain the process. Thanks, James
-
I installed lightroom cc and it shows that it is up to date. It will not open.
I installed lightroom cc and it shows that it is up to date. It will not open.
-
How do I repair admin account permissions in OS 10.6.8?
An attempted installation of the the Canon XF Plugin for Final Cut Pro 1.3 has failed (stopped before installing) showing an Error = 1. The folks at Canon pro support say this is a Mac OS error, and recommended that I need to repair my admin account