2

I have a problem, in the class generated by WebService Wizard of codename one. I can do the import java.io.PrintWriter, but when I compile the project I get this error:

error: cannot access

PrintWriter PrintWriter out = response.getWriter();

class file for java.io.PrintWriter not found

screenshot

Any suggestions?

JSON C11
  • 11,272
  • 7
  • 78
  • 65
platinum
  • 51
  • 1

2 Answers2

1

That class isn't included in CN1. See the Javadoc here: https://www.codenameone.com/javadoc/index.html

James H
  • 1,116
  • 1
  • 6
  • 11
0

You generated the servlet portion into the Codename One project instead of generating it into a JavaEE project. As James said that class doesn't exist in Codename One and neither does servlets.

I'm guessing you "fixed" the latter by changing the classpath of the Codename One project which you shouldn't have!

The wizard uses the current project for generating the stubs/skeletons it then asks you for a path to the server project and you picked the Codename One project instead of a WAR (web) project.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65