Play framework Documentation Task List Example Error - java

In Browser:
Compilation error
error: cannot find symbol
In /home/william/fmj/app/controllers/Application.java at line 28.
24 public static Result deleteTask(Long id) {
25 return TODO;
26 }
27
28 static Form<Task> taskForm = form(Task.class);
29
In Terminal:
[error] static Form<Task> taskForm = form(Task.class);
[error] ^
[error] symbol: class Task
[error] location: class Application
[error] /home/william/fmj/app/controllers/Application.java:16: error: cannot find symbol
[error] views.html.index.render(Task.all(), taskForm)
[error] ^
[error] symbol: variable Task
[error] location: class Application
[error] /home/william/fmj/app/controllers/Application.java:28: error: cannot find symbol
[error] static Form<Task> taskForm = form(Task.class);
[error] ^
[error] symbol: class Task
[error] location: class Application
[error] 3 errors
[error] {file:/home/william/fmj/}fmj/compile:compile: javac returned nonzero exit code
Any Help is greatly appreciated. I copy and pasted the code off of the tutorial (http://www.playframework.org/documentation/2.0.2/JavaTodoList) I'm not sure what's going wrong and I'd really like to learn this technology!

Apparently you didn't import Task model into your Application controller
You have 3 solutions:
Import each model manually:
import models.Task;
import exactly all models into your controller (it will be the best at the beginning, but...)
import models.*
Most recommended: Use some IDE which knows when and how to import required packages and classes and suggest you what should be imported (or not) (ie. IntelliJ Idea - just suggestion)

I got the same problem (error: cannot find symbol), sure that I have
import models.*;
but the error is still there.
I'm using eclipse 4.2, and it just suggest create new method form(Class<Task>

Related

Gauge Failed to start gauge API: Error occurred while waiting for runner process to finish

I'm quite new to gauge and have problems running a set of gauge tests. When I try to gauge run I get the following console output:
src\main\java\de\...\qa\Common.java:3: error: package com.github.....gauge.graphql does not exist
import com.github.....gauge.graphql.GraphqlSetup;
^
symbol: class VariableStorage
location: class Pricing
src\main\java\de\...\qa\testcraft\GaugeTestCraft.java:3: error: package com.github.....gauge.random.data does not exist
import com.github.....gauge.random.data.VariableStorage;
^
src\main\java\de\...\qa\testcraft\TestCraftExecutor.java:4: error: package org.tinylog does not exist
import org.tinylog.Logger;
^
src\test\java\de\...\qa\PricingTest.java:8: error: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
^
src\test\java\de\...\qa\PricingTest.java:9: error: package org.yaml.snakeyaml does not exist
import org.yaml.snakeyaml.Yaml;
^
src\test\java\de\...\qa\TestVariableStorage.java:3: error: package com.github.....gauge.random.data does not exist
import com.github.....gauge.random.data.VariableStorage;
^
src\test\java\de\...\qa\TestVariableStorage.java:9: error: cannot find symbol
public class TestVariableStorage implements VariableStorage {
^
symbol: class VariableStorage
src\test\java\de\...\qa\PricingTest.java:26: error: cannot find symbol
#Test
^
symbol: class Test
location: class PricingTest
src\test\java\de\...\qa\PricingTest.java:33: error: cannot find symbol
#Test
^
symbol: variable Logger
location: class TestCraftExecutor
src\test\java\de\...\qa\TestVariableStorage.java:12: error: method does not override or implement a method from a supertype
#Override
^
src\test\java\de\...\qa\TestVariableStorage.java:17: error: method does not override or implement a method from a supertype
#Override
^
src\test\java\de\...\qa\TestVariableStorage.java:22: error: method does not override or implement a method from a supertype
#Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
55 errors
Error occurred while waiting for runner process to finish.
Error : exit status 1
Error ----------------------------------
[Gauge]
Failed to start gauge API: Error occurred while waiting for runner process to finish.
Error : exit status 1
Get Support ----------------------------
Docs: https://docs.gauge.org
Bugs: https://github.com/getgauge/gauge/issues
Chat: https://spectrum.chat/gauge
Your Environment Information -----------
windows, 1.1.1, 6e0d83f
html-report (4.0.12), java (0.7.9), python (0.3.11), screenshot (0.0.1), xml-report (0.2.3)
Does someone know how this happens and how to solve it? Here are some additional informations:
Java version:14.0.2
Gauge version: 1.1.1
Maven version: 3.6.3
I just resolve the problem.
You should check your project's gauge.log. The Traceback is in the file, that will help you.
Don`t see the output, it will not work.

import android.support.v4.app.ActivityCompat;

This is the error i am seeing when i add "simple_permissions" package. How can i fix this? I recently upgraded flutter and it used to work very well before the upgrade.
/root/flutter/.pub-cache/hosted/pub.dartlang.org/simple_permissions-0.1.9/android/src/main/java/com/ethras/simplepermissions/SimplePermissionsPlugin.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
/root/flutter/.pub-cache/hosted/pub.dartlang.org/simple_permissions-0.1.9/android/src/main/java/com/ethras/simplepermissions/SimplePermissionsPlugin.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
symbol: class ActivityCompat
location: package android.support.v4.app
/root/flutter/.pub-cache/hosted/pub.dartlang.org/simple_permissions-0.1.9/android/src/main/java/com/ethras/simplepermissions/SimplePermissionsPlugin.java:10: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
/root/flutter/.pub-cache/hosted/pub.dartlang.org/simple_permissions-0.1.9/android/src/main/java/com/ethras/simplepermissions/SimplePermissionsPlugin.java:156: error: cannot find symbol
ActivityCompat.requestPermissions(activity, perm, 0);
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
/root/flutter/.pub-cache/hosted/pub.dartlang.org/simple_permissions-0.1.9/android/src/main/java/com/ethras/simplepermissions/SimplePermissionsPlugin.java:163: error: cannot find symbol
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, permission);
symbol: variable ContextCompat
location: class SimplePermissionsPlugin
/root/flutter/.pub-cache/hosted/pub.dartlang.org/simple_permissions-0.1.9/android/src/main/java/com/ethras/simplepermissions/SimplePermissionsPlugin.java:171: error: cannot find symbol
if (ActivityCompat.shouldShowRequestPermissionRationale(registrar.activity(), permission)) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
/root/flutter/.pub-cache/hosted/pub.dartlang.org/simple_permissions-0.1.9/android/src/main/java/com/ethras/simplepermissions/SimplePermissionsPlugin.java:175: error: cannot find symbol
if (ActivityCompat.checkSelfPermission(registrar.context(), permission) == PackageManager.PERMISSION_GRANTED) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':simple_permissions:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
[!] Flutter tried to create the file `android/settings_aar.gradle`, but failed.
To manually update `settings.gradle`, follow these steps:
1. Copy `settings.gradle` as `settings_aar.gradle`
2. Remove the following code from `settings_aar.gradle`:
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
Exception: Please create the file and run this command again.
Exited (sigterm)
I suggest you to check the package before using it.
It seems that simple_permissions is outdated and this package hasn't been updated since 2018 and its repository is gone from github, consider using other package like permission_handler.
Cheers.

JOGL errors on compilation

I am working with JOGL and it stopped working completely.
These are the errors i get:
Texture01.java:27: error: cannot access WriteCloneable
canvas = new GLCanvas(glcapabilities);
^
class file for com.jogamp.common.type.WriteCloneable not found
.\Texture01_GLEventListener.java:2: error: package com.jogamp.common.nio does not exist
import com.jogamp.common.nio.*;
^
.\Texture01_GLEventListener.java:136: error: cannot find symbol
FloatBuffer fb = Buffers.newDirectFloatBuffer(vertices);
^
symbol: variable Buffers
location: class Texture01_GLEventListener
.\Texture01_GLEventListener.java:163: error: cannot find symbol
IntBuffer ib = Buffers.newDirectIntBuffer(indices);
^
symbol: variable Buffers
location: class Texture01_GLEventListener
4 errors
The Path and Classpath variables are correct, I reinstalled JDK and JOGL2 but still get an error with WriteClonable and com.jogamp.common.nio.*
Any help is appreciated!

How to reference a Widget in GWT UiBinder?

Is it possible to reference a UiBinder created widget and pass is to a setter of other widget in *.ui.xml file?
I've tried following code to create a label (CustomLabel) that can listen to and follow the state of form widget (CustomWidget). The problem is that GWT compilation fails with:
[ERROR] Exception in thread "main" java.lang.StackOverflowError
[ERROR] at sun.nio.cs.UTF_8$Encoder.encodeLoop(UTF_8.java:691)
[ERROR] at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:579)
[ERROR] at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:271)
[ERROR] at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
[ERROR] at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
[ERROR] at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
[ERROR] at java.io.BufferedWriter.flush(BufferedWriter.java:253)
[ERROR] at java.io.PrintWriter.newLine(PrintWriter.java:482)
[ERROR] at java.io.PrintWriter.println(PrintWriter.java:629)
[ERROR] at java.io.PrintWriter.println(PrintWriter.java:740)
[ERROR] at com.google.gwt.dev.util.log.PrintWriterTreeLogger.doLog(PrintWriterTreeLogger.java:79)
[ERROR] at com.google.gwt.dev.util.log.PrintWriterTreeLogger.doCommitBranch(PrintWriterTreeLogger.java:65)
[ERROR] at com.google.gwt.dev.util.log.AbstractTreeLogger.commitMyBranchEntryInMyParentLogger(AbstractTreeLogger.java:256)
[ERROR] at com.google.gwt.dev.util.log.AbstractTreeLogger.branch(AbstractTreeLogger.java:167)
[ERROR] at com.google.gwt.core.ext.TreeLogger.branch(TreeLogger.java:212)
[ERROR] at com.google.gwt.editor.rebind.model.EditorModel.createEditorData(EditorModel.java:381)
[ERROR] at com.google.gwt.editor.rebind.model.EditorModel.createEditorData(EditorModel.java:390)
[ERROR] at com.google.gwt.editor.rebind.model.EditorModel.createEditorData(EditorModel.java:390)
View.ui.xml:
<g:HTMLPanel>
<x:CustomLabel forTarget={widget} />
<x:CustomWidget ui:field="widget" />
</g:HTMLPanel>
View.java:
#UiField
CustomWidget widget;
CustomLabel.java:
public void setForTarged(CustomWidget forTarget) {
this.forTarget = forTarget
}
In principle this should work. I use similar references in my code.
In your View.java:
#UiField
CustomWidget customWidget;
should be
#UiField
CustomWidget widget;
No, you cannot do it this way - no widget is available yet when your setForTarget method is called by UiBinder.
You can call this method in your code after your custom widget has been initialized.

"error: package org.apache.commons.math3.random does not exist"?

I'm trying to compile a java code as in the following line :
javac -classpath /Users/tim/kws/code/library:/Users/moab/kws/code/commons-cli-1.2/commons-cli-1.2.jar:/Users/tim/kws/code/commons-math-2.2/commons-math-2.2.jar:/Users/tim/kws/code/common-math3-3.1.1/commons-math3-3.1.1.jar RATSWriteLandmarksFromPfile.java
/Users/tim/kws/code/library/ppm/types/LabelPfile.java:17: error: package org.apache.commons.math3.random does not exist
import org.apache.commons.math3.random.RandomDataImpl;
^
/Users/tim/kws/code/library/ppm/types/LabelPfile.java:50: error: cannot find symbol
private RandomDataImpl randomData_;
^
symbol: class RandomDataImpl
location: class LabelPfile
/Users/tim/kws/code/library/ppm/types/LabelPfile.java:321: error: cannot find symbol
randomData_ = new RandomDataImpl();
^
symbol: class RandomDataImpl
location: class LabelPfile
3 errors
does anybody know why am I getting these errors ?
Seems like you are missing the commons-math3 library.

Categories

Resources