Comments (7)
Please post the entire contents of Thread.pde, since the error is being reported on line 49, and your snippet doesn't reflect this.
from processing-sublime.
@ybakos the whole program is not relevant to the specific error, but here it is.
as I said, this works inside Processing but not in Processing Sublime
//import java.lang.Thread;
SpeakThread runningThread;
void setup() {
runningThread = new SpeakThread();
// thread("readKeys");
}
void draw() {
}
void checkKeys() {
println("checkKeys");
if (keyPressed) {
if (key == 'q') {
println("QQQ");
runningThread.isRunning = false;
;
}
}
}
void keyPressed() {
println("Key");
if (key == 'q') {
runningThread.isRunning = false;
}
if (key == 't') {
runningThread.start();
//runningThread.run();
}
}
class SpeakThread extends Thread {
public boolean isRunning;
private int counter;
public void stopRunning() {
this.isRunning = false;
}
public void run() {
this.isRunning = true;
this.counter = 0;
println("running");
while (this.isRunning) {
checkKeys();
println("Sleeping...");
try {
counter++;
Thread.sleep(100);
}
catch(InterruptException ie) {
println("trouble sleeping");
}
if (counter > 30) {
this.isRunning = false;
}
println("counter: " + counter);
}
println("done");
return;
}
}
from processing-sublime.
@ubidefeo Runs just fine for me in both Processing and from Sublime - assuming I fix the syntax error of InterruptException
to InterruptedException
.
from processing-sublime.
@ybakos even after fixing that I get the same error.
Thread.pde:49:0:49:0: The function sleep(int) does not exist.
I added "Interrupt" at a later time, the compiler won't complain about it being just an Exception
, thinking it would help but it didn't.
On which OS are you?
Java version?
maybe it can help me figure out why I have this issue.
I'd much rather write my processing code in ST than the Processing editor :)
from processing-sublime.
@ybakos I found my issue, and I think it's relevant to everyone using Processing-Sublime
The compiler is not able to find imports/definitions for source which is not in the standard Processing documents folder.
On Mac, I keep my original Processing sketches in my Documents folder (same for Arduino), but when I use ST I tend to keep my projects in another folder.
I think the processing-java
command fails to fully recognise things outside of its designated document folder (not sure why).
Now that I know I'll work in the standard sketch folder, but it would be great if a project could reside everywhere.
Thank you for your test
from processing-sublime.
@ubidefeo What operating system do you use?
We have never had a problem using the Processing Sublime plugin for projects that are not in the default sketches directory.
For example, I created an empty sketch on my Desktop (MacOS), pasted your code, ran it with the sublime plugin, and do not receive any error.
from processing-sublime.
I'm on Mac OS 10.12.6 (Sierra).
Java 8 (1.8.0_162)
same exact code works in Processing 3.3.6 and ST as long as the project resides in the ~/Documents/Processing
folder.
If I move it anywhere else then imports fail and some classes are not found.
Not sure what to make of it.
I don't use Processing that often and never tried creating a Thread in Processing-Sublime before so it worked great for me so far.
I don't mind keeping the projects in the Documents folder now that I know, but I still wonder what causes this
from processing-sublime.
Related Issues (20)
- processing-sublime can't find libraries HOT 2
- Syntax for Cuda?
- What's the license for processing-sublime? HOT 4
- Support python mode
- support autocomplete HOT 1
- Still working with processing 3.0.2? HOT 2
- error on build after updating processing to 3.1 HOT 2
- Processing 3.1 with Sublim Text
- Why I cannot use it normally? HOT 1
- close already open app when you build again. HOT 1
- OSX Error Message: 'I don't know anything about -sketch=/Users/sysuser1/Desktop/Programming/Chatbots/twitbot/processing_example/.' HOT 2
- Single line comments aren't greyed out outside of a function HOT 1
- It's not compatible with version 3.3.5 HOT 1
- Syntax highlighting sometimes incorrect.
- Not Working on windows HOT 1
- MacOS Mojave - camera and microphone access not requested HOT 4
- Problem with sublime recognizing processing-java HOT 2
- Can you put in 'Find in Reference' support too?
- How to remove build-temp when the sketch stop to run HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from processing-sublime.