Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.<init>(Unknown Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at ToHtml.printStyles(ToHtml.java:215)
at ToHtml.printInlineStyle(ToHtml.java:199)
I am trying to get the excel spreadsheet data and converting it in someway to java. I'm looking for something that will print out the java code itself that way I can embed it into future projects.
I work on SSH for creating a external tool to manage remote OS.
I find out the JSch library and i create the java GUI project as jar application, and worked for me very well. (i am working on Netbeans ).
I introduce the JSch library with Netbeans as follow. Right click on the Project-> Properties -> Libraries ->Compile ->Add JAR/Folder.
After that i try to transform the project to applet in order to work it form web server.
I made the transformation in all the code.
When i run the applet through the Netbeans it worked for me. When i build the project to create the jar file.
I create a folder with the my.jar file, index.html, a folder named (lib) which contains the jsch-0.1.50.jar file.
Then try to run the index.html, the GUI appear but cannot connect to the remote with the SSH, and does not give any error.
I think that the problem is that my.jar cannot communicate with the jsch-0.1.50.jar.
Why the project runs trough the Netbeans an does not run when i call it from the next html code.
index.html
Java Code:
<Html> <Head> <Title>Java Example</Title> </Head> <Body> This is my page<br> Below you see an applet<br> <br> <Applet Code="AppletUI.class" archive="my.jar" width=600 Height=700> </Applet> <Body> </Body> </Html> mh_sh_highlight_all('java');
I'm trying to learn how to read from, and write to, Excel files. I'm looking at this link : [URL] ....
It seems like there are some Apache dependencies. So, I go here : [URL] .....
I downloaded the zipped file from the first link. Now what? I don't see any .exe file, or any way of installing it. How do I install it, or run it, or whatever? What is the next step here?
I'm trying to read a .xlsx file using Apache Poi on Eclipse and store the data into an ArrayList.
My code :
import org.apache.poi.ss.usermodel.*; import java.io.*; import java.util.*; public class parseReadFiles { public static void main(String[] args) {
[Code] ....
I keep getting a FileNotFoundException: Users/Divjot/Desktop/first.xlsx (No such file or directory). I've tried different combinations of file names and paths but can't get the program to find it. Should the file be stored in a special place or should the class path be different?
"Import org.apache.commons.codec cannot be resolved", which after searching seems to be a somewhat common problem. The solution being to go to: FileUpload - Home and download some jar file and add it to the /web-inf/lib folder. yet the error persists even after adding the jar file in "add external jar files" and restarting eclipse.
The jar file I added is called "commons-fileupload-1.3.1.jar" which is the only one I could find in the zip file. I've searched around looking at numerous threads about the issue, several of them sadly several years old, with no success.Surely installing a library to eclipse shouldn't be this complicated?
I'm using apache POI to input data from a excel database. I have a method that is supposed to count the number of rows containing data so I can use that number to initialize an object array. It's returning one more than the actual number of rows and I can't figure out why.
public int getDataRange() throws IOException{ int rowCount = 0; Iterator<Row> rows = sheet.rowIterator(); while(rows.hasNext()){ HSSFRow row = (HSSFRow) rows.next(); rowCount++;
[Code] .....
I get an array index out of bounds exception at the highlighted line.
It works in the first time. But, after sometime the data is not retrieved and display empty screen. Once, i stop and start the server again, the data is getting retrieved again. But, later when we refresh the empty page is getting displayed again.
I'm currently using TextPad or command prompt to compile and run my programs, and as usual I am not having any luck importing external libraries, in particular apache commons.
I couldn't see any particularly obvious settings in TextPad to set a library or class path (which is annoying as I really like the program), so I jumped back to cmd prompt to run it from there. Aaaaaand i don't understand .
This is my file structure at present:
/mainProject //includes .java and .class files, and where I've successfully placed .jar files before.
The apache commons zip file was extracted here, making:
/mainProject/commons-lang3/apidocs/orgs/apache/commons/<folders> //the commons-lang3 folder contains the jars I'm navigating to the /mainProject folder in cmd prompt and typing (amongst many other things) javac -cp /mainProject/commons-lang3 MonsterGame.java //with the -cp being pointed at the folder the .jar is in i've tried pointing it at the root folder where the import statement begins in the code (ie mainProject/commons-lang3/apidocs), tried moving the .jar files to the mainProject folder (pointing -cp at it) and more. No luck.
it seems everytime i try to import a new library something goes wrong..... its become a bit of a stumbling block to be honest. I seem to spend most of my time dealing with the 'administrative' side of coding (that was the politest way i could put it ), am I not doing it right?
I've read I'm supposed to include the .jar in the classpath, not just the directory. is this correct? (it still doesn't work...!)
I am having some serious difficulty getting my project off the ground. I have the following code:
FileInputStream file = new FileInputStream(new File("src/retestchecker/test_sheet.xlsx")); //Get the workbook instance for XLS file XSSFWorkbook workbook = new XSSFWorkbook(file); //Get first sheet from the workbook XSSFSheet sheet = workbook.getSheetAt(0); Row row = sheet.getRow(0); Cell x = row.getCell(3); System.out.println(x);
Everything is properly imported, etc etc.. But I am getting this error and I am not sure what it means:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException at retestchecker.RetestChecker.main(RetestChecker.java:23) Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
[Code] .....
Java Result: 1
I am using Netbeans and the latest version of Apache POI that was released May 11, 2015.
The line 23 that the error refers to is this line:
java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324)
[Code] .....
I see the file "myApache.log" got created but there's no info in it when i re-test the error, I have other existing appenders and categories in this same file which do give output so I know it has nothing to do with the file or the path itself.
My perfect idea is to have a Hashmap that would increase size each Key & value added, it's almost like a self-increasing array. I mean I could just create a very large Hashmap for me to add objects to anytime I want with a key to be able to find the object. Is this the most efficient way, because I'm trying to make my Object Library compatible with any amount of Objects, however, I know there's a limit to how many values you can have in an array, but it's larger than I'll ever need.
Let's say I'm making a number storage program, and I may need from 3 to 8 numbers to be stored with a key to find them easily using a Hashmap, rarely I may need below 3 or above 8. So is it efficient for me to create a Hashmap that has 10 placeholders? Or can I make this more efficient. Note, my Library is static.
I have written a library in one project but cannot seem import to import it into my main project whenever I try Maven says it cant find it though it is installed in the repository and the .jar file is in the classpath.
Stack trace org.jclarion.clarion.lang.ClarionCompileError: Class Not Found:com.MyProj.app.MyClass near line:310 (selma012.clw) at org.jclarion.clarion.lang.Lexer.error(Lexer.java:190) at org.jclarion.clarion.compile.grammar.AbstractParser.error(AbstractParser.java:111) at org.jclarion.clarion.compile.grammar.AbstractParser.importJava(AbstractParser.java:463) at org.jclarion.clarion.compile.grammar.AbstractParser.emptyLex(AbstractParser.java:258)
I'm very new to Java and looking to expand knowledge base from Excel VBA..I'm looking to add or analyse data from a csv file in a time order fashion. i.e i want to keep/ add a cumulative total. (once i've achieved that i then want to look at a java equivalent of sumif...
I want to download objects (css , jpeg, html ,png ) using sockets in java without using httpurlconnection . How can i do this with simple socket library ?