I am using the jate toolkit, compilation works well, when i run the program, it did not find the root nlp_ressources folder while reading jate.proprieties, despite the path exist. you find below the file jate.proprieties:
jate.system.nlp=jate.system.nlp=C:/Users/faffou/workspace/nlp_resources
jate.system.term.maxwords=5
jate.system.term.ignore_digits=true
jate.system.term.frequency.counter.multithread=5
The error message is below. Please who can help me!!!
Exception in thread "main" java.io.FileNotFoundException: C:\faffou\workspace\Test\nlp_resources\stoplist.txt (Le chemin d’accès spécifié est introuvable)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at uk.ac.shef.dcs.oak.jate.util.control.StopList.loadStopList(StopList.java:44)
at uk.ac.shef.dcs.oak.jate.util.control.StopList.<init>(StopList.java:30)
at uk.ac.shef.dcs.oak.jate.test.TestTfIdf.main(TestTfIdf.java:62)
It looks like you don't have stoplist.txt file in this folder. Jate tries to load stoplist.txt which has configuration about the words which shouldn't be processed make sure it exists if not try with creating empty one! I don't remember structure of this file unfortunately.
Thinks for your responses.
I solved the problem, in fact I changed the path of my file and I changed the shape of the url from:
C:/Users/faffou/workspace/Test/nlp_resources
to
C://nlp_resources
Related
I created a utility for moving some text data into a SQL database and have implemented logging(log4j) for debugging purposes.
Once i created a jar of my utility and called it for execution, the utility works fine but each time, the output is preceded by the below error message:
log4j:ERROR Could not read configuration file [log4j.properties].
java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:306)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:324)
at spotfire.loadtest.Driver.main(Driver.java:28)
log4j:ERROR Ignoring configuration file [log4j.properties].
log4j:WARN No appenders could be found for logger (spotfire.loadtest.Driver).
log4j:WARN Please initialize the log4j system properly.
Please note that my utility works and the text is inserted into the database. The only issue I face is how to get rid of this error message. Is there any way to stop printing it altogether??
Either your log4j.properties has to be in classpath or you need to specify it as JVM Argument as
-Dlog4j.configuration={path to file}
Iam sharing my github url
https://github.com/jino555/Keyword_framework/tree/master/src/config
Please have a look
Full Error
log4j:WARN No appenders could be found for logger (utility.Log).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.io.FileNotFoundException: D:\Tools QA Projects\trunk\Hybrid KeyWord Driven\src\config\OR.txt (The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at executionEngine.DriverScript.main(DriverScript.java:39)
Try to replace:
D:\Tools QA Projects\trunk\Hybrid KeyWord Driven\src\config\OR.txt
with:
D:\Tools\QA Projects\trunk\Hybrid KeyWord Driven\src\main\java\config\OR.txt
I believe Tools and QA Projects are diffrenet folders. Also as your gitHub repository shows the preject structure looks like:
...\src\main\java\config\OR.txt
and not like
...\src\config\OR.txt
So the problem is with the path to the file you providing. We cannot find the right path for you, because we don't know where is your project stored locally.
I have used
File file = new File(Game.class.getResource("Tiles.txt").getFile())
to get the txt file from my resources folder and it works fine when inside the IDE but when building to a jar and running outside of the environment it throws file not found errors (which i saw through running in CMD).
I use a similar method to get all my images and sprite sheets:
BufferedImage loadedImage = ImageIO.read(Game.class.getResourceAsStream("EG.png"));
how do they differ in importing files and why is my path incorrect?
Error CMD gives:
http://imgur.com/a/1SC1L
C:\Users\Taka\Desktop>java -jar ProjectC-Revamped.jar
java.io.FileNotFoundException: file:\C:\Users\Taka\Desktop\ProjectC-Revamped.jar!\Tiles.txt (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.util.Scanner.<init>(Unknown Source)
at Tiles.<init>(Tiles.java:16)
at Game.<init>(Game.java:91)
at Game.main(Game.java:192)
java.io.FileNotFoundException: file:\C:\Users\Taka\Desktop\ProjectC-Revamped.jar!\Maps\Map.txt (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.util.Scanner.<init>(Unknown Source)
at Map.<init>(Map.java:20)
at Game.<init>(Game.java:94)
at Game.main(Game.java:192)
use getResourceAsStream() instead of getResource(): see this SO answer for details
URL.getFile() does not convert a URL to a file. It merely returns the path and query portions of the URL. The method is named getFile() only because the URL class was part of Java 1.0, which was released in 1995, back when most URLs happened to point to actual files.
The path returned by URL.getFile() returns a String which may or may not be a valid file path. Many characters may not legally appear in URLs, so they will be percent-escaped. A good example is spaces; for example, file:///C:/Program%20Files/Java.
In short, converting a URL to a file using getFile() is not safe and will eventually fail.
Also, an entry in a .jar file is not a file. A .jar file is a single archive file. Its entries are just subsequences of bytes (representing compressed data). On the other hand, the URL returned by getResource is always valid (assuming it’s not null), even if it represents a .jar entry.
I was wondering if someone could help me find a good resource to help me fix this issue. I'm trying to create/save a batch file in the startups folder. Here's the general path: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\startup_PMA_popup_check.bat
I've read a lot of things saying that I should simply elevate the privileges of my java program.
I read that if I was to make my jar file a windows executable, then the rights of the program are automatically elevated to admin privileges.
What you're seeing below is my jar turned into an exe and run. The error I got was the same error as the one I got from running my jar. I no longer think that the problem is simply giving my program admin privilege.
I performed a test outside of my program by going to this path and attempting to move a file into the folder. Assuming I'd have no issue "since I am root already", I went ahead expecting to get no prompts. What I got was a popup saying that I needed to confirm that I was Admin & to confirm that I wanted to put the batch file in the folder.
My question is how should I make my java program issue this prompt to the user or something so my program can continue & not crash like shown below??:
Exception in thread "main" java.io.FileNotFoundException:
C:\ProgramData\Microsoft\Windows\Start
Menu\Programs\StartUp\startup_PMA_popup_check.bat (Access is denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at java.io.PrintWriter.(Unknown Source)
at java.io.PrintWriter.(Unknown Source)
at prioritymanagementassistant.Background.createBatchFile(Background.java:106)
at prioritymanagementassistant.Main.main(Main.java:930)
Thank You for your time,
Trying to use the python TweetNLP wrapper CMUTagger, but its throwing the following error:
java.io.FileNotFoundException: \dev\stdin (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at cmu.arktweetnlp.util.BasicFileIO.openFileToReadUTF8(BasicFileIO.java:50)
at cmu.arktweetnlp.RunTagger.runTagger(RunTagger.java:93)
at cmu.arktweetnlp.RunTagger.main(RunTagger.java:364)
Sep 17, 2014 10:22:45 AM cmu.arktweetnlp.util.BasicFileIO openFileToReadUTF8
SEVERE: Could not open file:/dev/stdin
Reinstalled the JDK instead of the JRE only. Didn't fix a thing. Not sure what to do as i cant even locate the dev folder in the java directory... halp =(
Executes java program fine if the cmd line call without python is 'sh', 'runTagger.sh', '--output-format', 'conll', [File with tweets to tag], but i need it to tag incoming stream of tweets from python via stdin =)
EDIT found the dev/stdin in CygWin and tried adding the paths 'c:...\cygwin' and 'c:...\cygwin\dev' but again nothing happened
I was stuck on this forever as well. I found a workaround for it.
You could use the following code:
import subprocess
p = subprocess.check_output('java -XX:ParallelGCThreads=2 -Xmx500m -jar ark-tweet-nlp-0.3.2.jar examples/example_tweets.txt')
this will give you output for running the example_tweets file through the tagger.