Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:35:44+00:00 2026-05-31T06:35:44+00:00

In shared package i have a class that only uses a class from server

  • 0

In shared package i have a class that only uses a class from server package, only when it is on server, it is indepdendant of the GWT, and i have made it transient

if (!GWT.isClient())
    ServerLogger loggerServer;

but it does not compile because it is in shared.. Can i worourund in here?, I just want for the GoogleCompile to work, it should not have the functionality of the server logger.
Is there a workaround?

How to write my own module which is NULL overall, because i only want to stop the compiler of erroring.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:35:45+00:00Added an answer on May 31, 2026 at 6:35 am

    GWT is still trying to compile this code. You will want to use Deferred Binding and <super-source> to swap in the implementation you need at compile-time, so that GWT doesn’t try to compile this server-specific code.

    Either that, or have the ServerLogger implementation be an interface dependency on this shared class, and pass in the correct implementation in server/client:

    // in your shared package
    
    public class SharedClass {
      private final LoggingClass logging;
      public SharedClass(LoggingClass logging) {
        this.logging = logging;
      }
    
      public void log(String msg) {
        logging.log(msg);
      }
    }
    
    public interface LoggingClass {
      public void log(String msg);
    }
    
    // in your client package
    
    public class ClientLogging implements LoggingClass {
      public void log(String msg) { GWT.log(msg); }
    }
    
    // in your server package
    
    public class ServerLogging implements LoggingClass {
      public void log(String msg) { ServerLogger.log(msg); }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my own little serialiser class package mypackage.shared; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import
I have a shared library that I wish to link an executable against using
I have a client/server program that attempts to send and receive an object. There
I have an existing (C# based) windows service that is derived from the Installer
I have a very simple python package that I build into debian packages using
I'm trying to understand the RPC functionality which GWT uses, and have followed this
I have this class : package scripts; public class TestStatic { public static void
If I have something like: package { public class Main() { public function Main()
I have 2 different webapps (package into different war files) which needs to share
I have an interface that has multiple small JTables stacked on top of each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.