path

using Runtime.exec() in Java

折月煮酒 提交于 2019-12-17 13:27:13
问题 What do you have to do in Java to get the Runtime.exec() to run a program that is on the path? I'm trying to run gpsbabel which I have put into the path (/usr/local/bin). public class GpxLib { public static void main(String[] args) { try { Runtime r = Runtime.getRuntime(); Process p = r.exec("gpsbabel -i garmin -f usb: -o gpx -F -"); InputStream is = p.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); while (true) { String s = br.readLine(); if (s == null)

Cannot find the file specified when using subprocess.call('dir', shell=True) in Python

北城余情 提交于 2019-12-17 12:15:11
问题 In a 64-bit system with 32 bit python 2.7 installed I am trying to do the following: import subprocess p = subprocess.call('dir', shell=True) print p But this gives me: Traceback (most recent call last): File "test.py", line 2, in <module> p = subprocess.call('dir', shell=True) File "C:\Python27\lib\subprocess.py", line 522, in call return Popen(*popenargs, **kwargs).wait() File "C:\Python27\lib\subprocess.py", line 709, in __init__ errread, errwrite) File "C:\Python27\lib\subprocess.py",

SPARQL property path queries with arbitrary properties

▼魔方 西西 提交于 2019-12-17 10:55:11
问题 SPARQL property path queries of arbitrary length require using specific properties. I want to query and find any path starting from a resource and ending in another resource. For example: SELECT ?p WHERE { :startNode ?p* :endNode } where ?p* specifies a path. Is there a way of doing this? 回答1: You're right that you can't use variables in property path expressions. There are a few things that you can do, though, that might help you. A wildcard to check whether a path exists You can use a

Setting the correct PATH for Eclipse

旧巷老猫 提交于 2019-12-17 10:44:40
问题 I recently changed my path so I could follow along in the Head First Java book and I had Eclipse before. Now when I try to get onto Eclipse again it won't open because it says it can't find a JRE or JDK to use in my directory. I have moved the JDK file around. I have jdk1.8.0_60 downloaded. So how can I get Eclipse to open again? 回答1: Like Abob said: Eclipse doesn't consult the JAVA_HOME variable You should specify where Eclipse should find your JDK in the file eclipse.ini . Specifically, the

How to persistently set a variable in Windows 7 from a batch file?

不羁的心 提交于 2019-12-17 10:17:07
问题 I am trying to set the PATH environment variable in windows 7 using a bat-file; however it does not seem to work. I am using this windows command: set PATH=%cd%;%path% pause However it only appears to be valid for this cmd instance. I want it to be permanent, since I first set the PATH and then run a program which needs to locate the libraries in that folder. 回答1: Use setx.exe instead of set. setx PATH "%cd%;%path%;" pause Note that this sets the path for all future cmd instances, but not for

How can I shortern my command line prompt's current directory?

自闭症网瘾萝莉.ら 提交于 2019-12-17 10:14:51
问题 I am using Ubuntu and I am tired of this long prompts in bash when I am working with some deep directory hierarchy. So, I would like to tweak my PS1 to shorten the working directory part the following way: Currently I have: pajton@dragon:~/workspace/projects/project1/folder1/test$ and would like to have: pajton@dragon:~/workspace/.../folder1/test$ The truncating would occur if len($PWD) passes given threshold. I want to always keep the first path component and at least one last path component

Command Prompt - How to add a set path only for that batch file executing?

本秂侑毒 提交于 2019-12-17 10:08:15
问题 Basically, I know I can go through my control panel and modify the path variable. But, I'm wondering if there is a way to through batch programming have a temporary path included? That way it is only used during that batch file execution. I don't want to have people go in and modify their path variables just to use my batch file. 回答1: Just like any other environment variable, with SET: SET PATH=%PATH%;c:\whatever\else If you want to have a little safety check built in first, check to see if

Keras import error Nadam

喜你入骨 提交于 2019-12-17 09:59:33
问题 I am getting an import error when trying to import the Keras module Nadam: >>> from keras.optimizers import Nadam Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name Nadam I can import and use SGD, Adam, etc, just not this optimizer. Any help appreciated. I installed Keras using: git clone https://github.com/fchollet/keras.git sudo python2.7 setup.py install I have just found that, if I try to import it using the shell immediately after

How can I set the PATH variable for javac so I can manually compile my .java works?

守給你的承諾、 提交于 2019-12-17 09:58:37
问题 Here's the address on my drive: C:\Program Files\Java\jdk1.6.0_18\bin How would I go about setting the path variable so I can go in command window (windowskey+r "cmd") and be able to type things like: javac TestApp.java I'm using Windows 7 Professional. 回答1: Typing the SET PATH command into the command shell every time you fire it up could get old for you pretty fast. Three alternatives: Run javac from a batch ( .CMD ) file. Then you can just put the SET PATH into that file before your javac

How can I set the PATH variable for javac so I can manually compile my .java works?

本小妞迷上赌 提交于 2019-12-17 09:57:15
问题 Here's the address on my drive: C:\Program Files\Java\jdk1.6.0_18\bin How would I go about setting the path variable so I can go in command window (windowskey+r "cmd") and be able to type things like: javac TestApp.java I'm using Windows 7 Professional. 回答1: Typing the SET PATH command into the command shell every time you fire it up could get old for you pretty fast. Three alternatives: Run javac from a batch ( .CMD ) file. Then you can just put the SET PATH into that file before your javac